T
- The type of payload contained in this Messagepublic class GenericDomainEventMessage<T> extends GenericEventMessage<T> implements DomainEventMessage<T>
Constructor and Description |
---|
GenericDomainEventMessage(Object aggregateIdentifier,
long sequenceNumber,
T payload)
Initialize a DomainEventMessage originating from an Aggregate with the given
aggregateIdentifier ,
with given sequenceNumber and payload . |
GenericDomainEventMessage(Object aggregateIdentifier,
long sequenceNumber,
T payload,
Map<String,?> metaData)
Initialize a DomainEventMessage originating from an Aggregate with the given
aggregateIdentifier ,
with given sequenceNumber , metaData and payload . |
GenericDomainEventMessage(String identifier,
org.joda.time.DateTime timestamp,
Object aggregateIdentifier,
long sequenceNumber,
T payload,
Map<String,?> metaData)
Constructor to reconstruct a DomainEventMessage using existing data.
|
Modifier and Type | Method and Description |
---|---|
GenericDomainEventMessage<T> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this Message with it MetaData merged with the given
metaData . |
Object |
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 |
toString() |
GenericDomainEventMessage<T> |
withMetaData(Map<String,?> newMetaData)
Returns a copy of this Message with the given
metaData . |
asEventMessage, getTimestamp
getIdentifier, getMetaData, getPayload, getPayloadType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdentifier, getTimestamp
getMetaData, getPayload, getPayloadType
public GenericDomainEventMessage(Object aggregateIdentifier, long sequenceNumber, T payload)
aggregateIdentifier
,
with given sequenceNumber
and payload
. The MetaData of the message is empty.aggregateIdentifier
- The identifier of the aggregate generating this messagesequenceNumber
- The message's sequence numberpayload
- The application-specific payload of the messagepublic GenericDomainEventMessage(Object aggregateIdentifier, long sequenceNumber, T payload, Map<String,?> metaData)
aggregateIdentifier
,
with given sequenceNumber
, metaData
and payload
.aggregateIdentifier
- 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 identifier, org.joda.time.DateTime timestamp, Object aggregateIdentifier, long sequenceNumber, T payload, Map<String,?> metaData)
identifier
- The identifier of the Messagetimestamp
- The timestamp of the Message creationaggregateIdentifier
- The identifier of the aggregate from which the message originatessequenceNumber
- The sequence number of the message withing the originating aggregatepayload
- The payload of the messagemetaData
- The meta data of the messagepublic long getSequenceNumber()
DomainEventMessage
getSequenceNumber
in interface DomainEventMessage<T>
public Object getAggregateIdentifier()
DomainEventMessage
getAggregateIdentifier
in interface DomainEventMessage<T>
public GenericDomainEventMessage<T> withMetaData(Map<String,?> newMetaData)
Message
metaData
. The payload remains unchanged.
While the implementation returned may be different than the implementation of this
, implementations
must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent
errors further downstream.withMetaData
in interface DomainEventMessage<T>
withMetaData
in interface EventMessage<T>
withMetaData
in interface Message<T>
withMetaData
in class GenericEventMessage<T>
newMetaData
- The new MetaData for the Messagepublic GenericDomainEventMessage<T> andMetaData(Map<String,?> additionalMetaData)
Message
metaData
. The payload
remains unchanged.andMetaData
in interface DomainEventMessage<T>
andMetaData
in interface EventMessage<T>
andMetaData
in interface Message<T>
andMetaData
in class GenericEventMessage<T>
additionalMetaData
- The MetaData to merge withpublic String toString()
toString
in class GenericEventMessage<T>
Copyright © 2010-2014. All Rights Reserved.