T
- The type of payload contained in this Messagepublic class GenericDomainEventMessage<T> extends GenericEventMessage<T> implements DomainEventMessage<T>
DomainEventMessage
.clock
Modifier | Constructor and Description |
---|---|
protected |
GenericDomainEventMessage(String type,
String aggregateIdentifier,
long sequenceNumber,
Message<T> delegate,
Instant timestamp)
Initialize a DomainEventMessage originating from an Aggregate with the given
aggregateIdentifier ,
with given sequenceNumber and payload , metaData and timestamp . |
|
GenericDomainEventMessage(String type,
String aggregateIdentifier,
long sequenceNumber,
Message<T> delegate,
Supplier<Instant> timestamp)
Initialize a DomainEventMessage originating from an Aggregate using existing data.
|
|
GenericDomainEventMessage(String type,
String aggregateIdentifier,
long sequenceNumber,
T payload)
Initialize a DomainEventMessage originating from an Aggregate with the given
aggregateIdentifier ,
with given sequenceNumber and payload . |
|
GenericDomainEventMessage(String type,
String aggregateIdentifier,
long sequenceNumber,
T payload,
Map<String,?> metaData)
Initialize a DomainEventMessage originating from an Aggregate with the given
aggregateIdentifier ,
with given sequenceNumber and payload and metaData . |
|
GenericDomainEventMessage(String type,
String aggregateIdentifier,
long sequenceNumber,
T payload,
Map<String,?> metaData,
String messageIdentifier,
Instant timestamp)
Initialize a DomainEventMessage originating from an Aggregate using existing data.
|
Modifier and Type | Method and Description |
---|---|
GenericDomainEventMessage<T> |
andMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with it MetaData merged with the given
metaData . |
String |
getAggregateIdentifier()
Returns the identifier of the Aggregate that generated this DomainEvent.
|
long |
getSequenceNumber()
Returns the sequence number that allows DomainEvents originating from the same Aggregate to be placed in the
order of generation.
|
String |
getType()
Returns the type of the Aggregate that generated this DomainEvent.
|
GenericDomainEventMessage<T> |
withMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with the given
metaData . |
asEventMessage, getTimestamp
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIdentifier, getTimestamp
getMetaData, getPayload, getPayloadType
public GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload)
aggregateIdentifier
,
with given sequenceNumber
and payload
. The MetaData of the message is empty.type
- The domain typeaggregateIdentifier
- The identifier of the aggregate generating this messagesequenceNumber
- The message's sequence numberpayload
- The application-specific payload of the messagepublic GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload, Map<String,?> metaData)
aggregateIdentifier
,
with given sequenceNumber
and payload
and metaData
.type
- The domain typeaggregateIdentifier
- The identifier of the aggregate generating this messagesequenceNumber
- The message's sequence numberpayload
- The application-specific payload of the messagemetaData
- The MetaData to attach to the messagepublic GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload, Map<String,?> metaData, String messageIdentifier, Instant timestamp)
type
- The domain typeaggregateIdentifier
- The identifier of the aggregate generating this messagesequenceNumber
- The message's sequence numberpayload
- The application-specific payload of the messagemetaData
- The MetaData to attach to the messagemessageIdentifier
- The message identifiertimestamp
- The event's timestamppublic GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Supplier<Instant> timestamp)
type
- The domain typeaggregateIdentifier
- The identifier of the aggregate generating this messagesequenceNumber
- The message's sequence numberdelegate
- The delegate message providing the payload, metadata and identifier of the eventtimestamp
- The event's timestamp supplierprotected GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Instant timestamp)
aggregateIdentifier
,
with given sequenceNumber
and payload
, metaData
and timestamp
.type
- the aggregate typeaggregateIdentifier
- the aggregate identifiersequenceNumber
- the sequence number of the eventdelegate
- The delegate message providing the payload, metadata and identifier of the eventtimestamp
- the timestamp of the eventpublic String getType()
DomainEventMessage
getType
in interface DomainEventMessage<T>
public String getAggregateIdentifier()
DomainEventMessage
getAggregateIdentifier
in interface DomainEventMessage<T>
public long getSequenceNumber()
DomainEventMessage
getSequenceNumber
in interface DomainEventMessage<T>
public GenericDomainEventMessage<T> withMetaData(Map<String,?> metaData)
EventMessage
metaData
. The payload, Timestamp
and Identifier
remain unchanged.withMetaData
in interface EventMessage<T>
withMetaData
in interface DomainEventMessage<T>
withMetaData
in interface Message<T>
withMetaData
in class GenericEventMessage<T>
metaData
- The new MetaData for the Messagepublic GenericDomainEventMessage<T> andMetaData(Map<String,?> metaData)
EventMessage
metaData
. The payload,
Timestamp
and Identifier
remain unchanged.andMetaData
in interface EventMessage<T>
andMetaData
in interface DomainEventMessage<T>
andMetaData
in interface Message<T>
andMetaData
in class GenericEventMessage<T>
metaData
- The MetaData to merge withCopyright © 2010–2017. All rights reserved.