Package org.axonframework.eventhandling
Interface DomainEventMessage<T>
- Type Parameters:
T- The type of payload contained in this Message
- All Superinterfaces:
EventMessage<T>,Message<T>,Serializable
- All Known Implementing Classes:
GenericDomainEventMessage,GenericTrackedDomainEventMessage
Represents a Message that wraps a DomainEvent and an Event representing an important change in the Domain. In
contrast to a regular EventMessage, a DomainEventMessages contains the identifier of the Aggregate that reported it.
The DomainEventMessage's sequence number allows Messages to be placed in their order of generation.
- Since:
- 2.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this DomainEventMessage with its MetaData merged with the givenmetaData.Returns the identifier of the Aggregate that generated this DomainEvent.longReturns the sequence number that allows DomainEvents originating from the same Aggregate to be placed in the order of generation.getType()Returns the type of the Aggregate that generated this DomainEvent.withMetaData(Map<String, ?> metaData) Returns a copy of this DomainEventMessage with the givenmetaData.Methods inherited from interface org.axonframework.eventhandling.EventMessage
getIdentifier, getTimestampMethods inherited from interface org.axonframework.messaging.Message
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Method Details
-
getSequenceNumber
long getSequenceNumber()Returns the sequence number that allows DomainEvents originating from the same Aggregate to be placed in the order of generation.- Returns:
- the sequence number of this Event
-
getAggregateIdentifier
String getAggregateIdentifier()Returns the identifier of the Aggregate that generated this DomainEvent. Note that the value returned does not necessarily have to be the same instance that was provided at creation time. It is possible that (due to serialization, for example) the value returned here has a different structure.- Returns:
- the identifier of the Aggregate that generated this DomainEvent
-
getType
String getType()Returns the type of the Aggregate that generated this DomainEvent. By default this is equal to the simple class name of the aggregate root.- Returns:
- the type of the Aggregate that generated this DomainEvent
-
withMetaData
Returns a copy of this DomainEventMessage with the givenmetaData. The payload,TimestampandEventIdentifier, as well as theAggregate IdentifierandSequence Numberremain unchanged.- Specified by:
withMetaDatain interfaceEventMessage<T>- Specified by:
withMetaDatain interfaceMessage<T>- Parameters:
metaData- The new MetaData for the Message- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Returns a copy of this DomainEventMessage with its MetaData merged with the givenmetaData. The payload,TimestampandEventIdentifier, as well as theAggregate IdentifierandSequence Numberremain unchanged.- Specified by:
andMetaDatain interfaceEventMessage<T>- Specified by:
andMetaDatain interfaceMessage<T>- Parameters:
metaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-