Class: KubeMQ::PubSub::EventStoreMessage
- Inherits:
-
Object
- Object
- KubeMQ::PubSub::EventStoreMessage
- Defined in:
- lib/kubemq/pubsub/event_store_message.rb
Overview
Outbound durable event message for the events store pattern.
Unlike EventMessage, events store messages are persisted by the broker and can be replayed by subscribers using start-position policies. Pass to KubeMQ::PubSubClient#send_event_store or KubeMQ::PubSub::EventStoreSender#publish.
Instance Attribute Summary collapse
-
#body ⇒ String?
Message payload (binary-safe).
-
#channel ⇒ String
Target channel name.
-
#id ⇒ String
Unique message identifier (auto-generated UUID if not provided).
-
#metadata ⇒ String?
Arbitrary metadata string.
-
#tags ⇒ Hash{String => String}
User-defined key-value tags.
Instance Method Summary collapse
-
#initialize(channel:, metadata: nil, body: nil, tags: nil, id: nil) ⇒ EventStoreMessage
constructor
A new instance of EventStoreMessage.
Constructor Details
#initialize(channel:, metadata: nil, body: nil, tags: nil, id: nil) ⇒ EventStoreMessage
Returns a new instance of EventStoreMessage.
44 45 46 47 48 49 50 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 44 def initialize(channel:, metadata: nil, body: nil, tags: nil, id: nil) @id = id || SecureRandom.uuid @channel = channel @metadata = @body = body @tags = || {} end |
Instance Attribute Details
#body ⇒ String?
Returns message payload (binary-safe).
37 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 37 attr_accessor :id, :channel, :metadata, :body, :tags |
#channel ⇒ String
Returns target channel name.
37 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 37 attr_accessor :id, :channel, :metadata, :body, :tags |
#id ⇒ String
Returns unique message identifier (auto-generated UUID if not provided).
37 38 39 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 37 def id @id end |
#metadata ⇒ String?
Returns arbitrary metadata string.
37 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 37 attr_accessor :id, :channel, :metadata, :body, :tags |
#tags ⇒ Hash{String => String}
Returns user-defined key-value tags.
37 |
# File 'lib/kubemq/pubsub/event_store_message.rb', line 37 attr_accessor :id, :channel, :metadata, :body, :tags |