Class: KubeMQ::PubSub::EventMessage
- Inherits:
-
Object
- Object
- KubeMQ::PubSub::EventMessage
- Defined in:
- lib/kubemq/pubsub/event_message.rb
Overview
Outbound event message for fire-and-forget pub/sub.
Construct an EventMessage and pass it to KubeMQ::PubSubClient#send_event
or KubeMQ::PubSub::EventSender#publish. Events are not persisted — use
EventStoreMessage for durable delivery.
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) ⇒ EventMessage
constructor
A new instance of EventMessage.
Constructor Details
#initialize(channel:, metadata: nil, body: nil, tags: nil, id: nil) ⇒ EventMessage
Returns a new instance of EventMessage.
43 44 45 46 47 48 49 |
# File 'lib/kubemq/pubsub/event_message.rb', line 43 def initialize(channel:, metadata: nil, body: nil, tags: nil, id: nil) @id = id || SecureRandom.uuid @channel = channel = @body = body = || {} end |
Instance Attribute Details
#body ⇒ String?
Returns message payload (binary-safe).
36 |
# File 'lib/kubemq/pubsub/event_message.rb', line 36 attr_accessor :id, :channel, :metadata, :body, :tags |
#channel ⇒ String
Returns target channel name.
36 |
# File 'lib/kubemq/pubsub/event_message.rb', line 36 attr_accessor :id, :channel, :metadata, :body, :tags |
#id ⇒ String
Returns unique message identifier (auto-generated UUID if not provided).
36 37 38 |
# File 'lib/kubemq/pubsub/event_message.rb', line 36 def id @id end |
#metadata ⇒ String?
Returns arbitrary metadata string.
36 |
# File 'lib/kubemq/pubsub/event_message.rb', line 36 attr_accessor :id, :channel, :metadata, :body, :tags |
#tags ⇒ Hash{String => String}
Returns user-defined key-value tags.
36 |
# File 'lib/kubemq/pubsub/event_message.rb', line 36 attr_accessor :id, :channel, :metadata, :body, :tags |