Class: KubeMQ::PubSub::EventStoreReceived

Inherits:
Object
  • Object
show all
Defined in:
lib/kubemq/pubsub/event_store_received.rb

Overview

A durable event received from an events store subscription.

Delivered to the block passed to KubeMQ::PubSubClient#subscribe_to_events_store. The #sequence value can be used to track replay position.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, channel:, metadata:, body:, timestamp:, sequence:, tags:) ⇒ EventStoreReceived

Returns a new instance of EventStoreReceived.

Parameters:

  • id (String)

    event identifier

  • channel (String)

    source channel name

  • metadata (String)

    event metadata

  • body (String)

    event payload

  • timestamp (Integer)

    broker timestamp (Unix nanoseconds)

  • sequence (Integer)

    broker sequence number

  • tags (Hash{String => String}, nil)

    key-value tags



36
37
38
39
40
41
42
43
44
# File 'lib/kubemq/pubsub/event_store_received.rb', line 36

def initialize(id:, channel:, metadata:, body:, timestamp:, sequence:, tags:)
  @id = id
  @channel = channel
  @metadata = 
  @body = body
  @timestamp = timestamp
  @sequence = sequence
  @tags = tags || {}
end

Instance Attribute Details

#bodyString (readonly)

Returns event payload (binary).

Returns:

  • (String)

    event payload (binary)



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags

#channelString (readonly)

Returns the channel the event was published to.

Returns:

  • (String)

    the channel the event was published to



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags

#idString (readonly)

Returns unique event identifier.

Returns:

  • (String)

    unique event identifier



27
28
29
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

def id
  @id
end

#metadataString (readonly)

Returns event metadata.

Returns:

  • (String)

    event metadata



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags

#sequenceInteger (readonly)

Returns broker-assigned sequence number for replay tracking.

Returns:

  • (Integer)

    broker-assigned sequence number for replay tracking



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags

#tagsObject (readonly)

Returns the value of attribute tags.



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags

#timestampInteger (readonly)

Returns broker-assigned timestamp (Unix nanoseconds).

Returns:

  • (Integer)

    broker-assigned timestamp (Unix nanoseconds)



27
# File 'lib/kubemq/pubsub/event_store_received.rb', line 27

attr_reader :id, :channel, :metadata, :body, :timestamp, :sequence, :tags