T - The type of payload contained in this Messagepublic class GenericDomainEventMessage<T> extends GenericEventMessage<T> implements DomainEventMessage<T>
DomainEventMessage.clock| Constructor and Description |
|---|
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. |
protected void |
describeTo(StringBuilder stringBuilder)
Describe the message specific properties to the given
stringBuilder. |
protected String |
describeType()
Describe the type of message, used in
MessageDecorator.toString(). |
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, getTimestampgetDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIdentifier, getTimestampgetMetaData, getPayload, getPayloadType, serializeMetaData, serializePayloadpublic 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 supplierpublic 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()
DomainEventMessagegetType in interface DomainEventMessage<T>public String getAggregateIdentifier()
DomainEventMessagegetAggregateIdentifier in interface DomainEventMessage<T>public long getSequenceNumber()
DomainEventMessagegetSequenceNumber in interface DomainEventMessage<T>public GenericDomainEventMessage<T> withMetaData(@Nonnull Map<String,?> metaData)
EventMessagemetaData. The payload, Timestamp and Identifier remain unchanged.withMetaData in interface DomainEventMessage<T>withMetaData in interface EventMessage<T>withMetaData in interface Message<T>withMetaData in class GenericEventMessage<T>metaData - The new MetaData for the Messagepublic GenericDomainEventMessage<T> andMetaData(@Nonnull Map<String,?> metaData)
EventMessagemetaData. The payload, Timestamp and Identifier remain unchanged.andMetaData in interface DomainEventMessage<T>andMetaData in interface EventMessage<T>andMetaData in interface Message<T>andMetaData in class GenericEventMessage<T>metaData - The MetaData to merge withprotected void describeTo(StringBuilder stringBuilder)
MessageDecoratorstringBuilder. Subclasses should override this
method, calling the super method and appending their own properties to the end (or beginning).
As convention, String values should be enclosed in single quotes, Objects in curly brackets and numeric values may be appended without enclosing. All properties should be preceded by a comma when appending, or finish with a comma when prefixing values.
describeTo in class GenericEventMessage<T>stringBuilder - the builder to append data toprotected String describeType()
MessageDecoratorMessageDecorator.toString().
Defaults to the simple class name of the actual instance.
describeType in class GenericEventMessage<T>Copyright © 2010–2023. All rights reserved.