Class: Synapse::Serialization::SerializedDomainEventMessageBuilder

Inherits:
SerializedEventMessageBuilder show all
Defined in:
lib/synapse/serialization/message/serialized_message_builder.rb

Overview

Message builder capable of producing SerializedDomainEventMessage instances

Instance Attribute Summary collapse

Attributes inherited from SerializedMessageBuilder

#id, #metadata, #payload, #timestamp

Instance Method Summary collapse

Methods inherited from SerializedMessageBuilder

build

Instance Attribute Details

#aggregate_idObject

Returns:

  • (Object)


41
42
43
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 41

def aggregate_id
  @aggregate_id
end

#sequence_numberInteger

Returns:

  • (Integer)


44
45
46
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 44

def sequence_number
  @sequence_number
end

Instance Method Details

#buildSerializedDomainEventMessage



59
60
61
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 59

def build
  SerializedDomainEventMessage.new @id, @metadata, @payload, @timestamp, @aggregate_id, @sequence_number
end

#from_data(data, serializer) ⇒ undefined

Parameters:

Returns:

  • (undefined)


49
50
51
52
53
54
55
56
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 49

def from_data(data, serializer)
  @id = data.id
  @metadata ||= LazyObject.new data., serializer
  @payload ||= LazyObject.new data.payload, serializer
  @timestamp = data.timestamp
  @aggregate_id = data.aggregate_id
  @sequence_number = data.sequence_number
end