Class: KubeMQ::PubSub::EventReceived
- Inherits:
-
Object
- Object
- KubeMQ::PubSub::EventReceived
- Defined in:
- lib/kubemq/pubsub/event_received.rb
Overview
An event received from a pub/sub subscription.
Delivered to the block passed to KubeMQ::PubSubClient#subscribe_to_events. This is a read-only snapshot — modifying attributes has no effect on the broker.
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
Event payload (binary).
-
#channel ⇒ String
readonly
The channel the event was published to.
-
#id ⇒ String
readonly
Unique event identifier.
-
#metadata ⇒ String
readonly
Event metadata.
-
#sequence ⇒ Integer
readonly
Broker-assigned sequence number.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#timestamp ⇒ Integer
readonly
Broker-assigned timestamp (Unix nanoseconds).
Instance Method Summary collapse
-
#initialize(id:, channel:, metadata:, body:, timestamp:, sequence:, tags:) ⇒ EventReceived
constructor
A new instance of EventReceived.
Constructor Details
#initialize(id:, channel:, metadata:, body:, timestamp:, sequence:, tags:) ⇒ EventReceived
Returns a new instance of EventReceived.
37 38 39 40 41 42 43 44 45 |
# File 'lib/kubemq/pubsub/event_received.rb', line 37 def initialize(id:, channel:, metadata:, body:, timestamp:, sequence:, tags:) @id = id @channel = channel @metadata = @body = body @timestamp = @sequence = sequence @tags = || {} end |
Instance Attribute Details
#body ⇒ String (readonly)
Returns event payload (binary).
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |
#channel ⇒ String (readonly)
Returns the channel the event was published to.
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |
#id ⇒ String (readonly)
Returns unique event identifier.
28 29 30 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 def id @id end |
#metadata ⇒ String (readonly)
Returns event metadata.
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |
#sequence ⇒ Integer (readonly)
Returns broker-assigned sequence number.
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |
#timestamp ⇒ Integer (readonly)
Returns broker-assigned timestamp (Unix nanoseconds).
28 |
# File 'lib/kubemq/pubsub/event_received.rb', line 28 attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags |