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 EventMessage
Attributes inherited from Message
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id, metadata, payload, timestamp, aggregate_id, sequence_number) ⇒ undefined constructor
Methods inherited from EventMessage
Methods inherited from Message
#and_metadata, build, #payload_type, #with_metadata
Constructor Details
#initialize(id, metadata, payload, timestamp, aggregate_id, sequence_number) ⇒ undefined
74 75 76 77 78 79 |
# File 'lib/synapse/domain/message.rb', line 74 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
61 62 63 |
# File 'lib/synapse/domain/message.rb', line 61 def aggregate_id @aggregate_id end |
#sequence_number ⇒ Integer (readonly)
The sequence number of the event in the order of generation
65 66 67 |
# File 'lib/synapse/domain/message.rb', line 65 def sequence_number @sequence_number end |
Class Method Details
.builder ⇒ Class
82 83 84 |
# File 'lib/synapse/domain/message.rb', line 82 def self.builder DomainEventMessageBuilder end |