Class: Synapse::Domain::DomainEventMessage
- Inherits:
-
EventMessage
- Object
- Message
- EventMessage
- Synapse::Domain::DomainEventMessage
- Defined in:
- lib/synapse/domain/message.rb
Overview
Message that contains a domain event as a payload that represents a state change in the domain.
In contrast to a regular event message, this type of message contains the identifier of the aggregate that reported it. It also contains a sequence number that allows the messages to be placed in the order they were reported.
Instance Attribute Summary collapse
-
#aggregate_id ⇒ Object
readonly
The identifier of the aggregate that reported the event.
-
#sequence_number ⇒ Integer
readonly
The sequence number of the event in the order of generation.
Attributes inherited from Message
#id, #metadata, #payload, #timestamp
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id, metadata, payload, timestamp, aggregate_id, sequence_number) ⇒ undefined constructor
Methods inherited from Message
#and_metadata, as_message, build, #payload_type, #with_metadata
Constructor Details
#initialize(id, metadata, payload, timestamp, aggregate_id, sequence_number) ⇒ undefined
34 35 36 37 38 39 |
# File 'lib/synapse/domain/message.rb', line 34 def initialize(id, , payload, , aggregate_id, sequence_number) super id, , payload, @aggregate_id = aggregate_id @sequence_number = sequence_number end |
Instance Attribute Details
#aggregate_id ⇒ Object (readonly)
The identifier of the aggregate that reported the event
21 22 23 |
# File 'lib/synapse/domain/message.rb', line 21 def aggregate_id @aggregate_id end |
#sequence_number ⇒ Integer (readonly)
The sequence number of the event in the order of generation
25 26 27 |
# File 'lib/synapse/domain/message.rb', line 25 def sequence_number @sequence_number end |
Class Method Details
.builder ⇒ Class
42 43 44 |
# File 'lib/synapse/domain/message.rb', line 42 def self.builder DomainEventMessageBuilder end |