Class: Shamu::Events::Message
- Inherits:
-
Object
- Object
- Shamu::Events::Message
- Includes:
- Attributes, Attributes::Equality
- Defined in:
- lib/shamu/events/message.rb
Overview
The event Message consists of a set of well-defined attributes describing a single discrete event in the system and associated meta-data needed by subscribers to process the message.
Messages should attempt to forward the state available at the time the event was published so that subscribers can process the message without contacting additional services.
Event messages are serialized for network or IPC transimission and must
limit attributes to primitive types (Strings, Numbers, Arrays and Hashes)
so they can be round tripped with Message.new( message.to_attributes )
.
Attributes collapse
-
#id ⇒ String
The ID for the message.
Instance Method Summary collapse
-
#initialize ⇒ Message
constructor
A new instance of Message.
Methods included from Attributes::Equality
Methods included from Attributes
#[], #as_json, #assign_attributes, association, associations, attribute, #attribute?, attributes, #pretty_print, #set?, #slice, #to_attributes, #to_json
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
31 32 33 34 35 |
# File 'lib/shamu/events/message.rb', line 31 def initialize( * ) super @id ||= SecureRandom.uuid end |
Instance Attribute Details
#id ⇒ String
Returns the ID for the message. Automatically generated UUID.
25 |
# File 'lib/shamu/events/message.rb', line 25 attribute :id |