Package org.axonframework.eventhandling
Interface EventMessage<T>
- Type Parameters:
T- The type of payload contained in this Message
- All Superinterfaces:
Message<T>,Serializable
- All Known Subinterfaces:
DeadlineMessage<T>,DomainEventMessage<T>,TrackedEventMessage<T>
- All Known Implementing Classes:
GenericDeadlineMessage,GenericDomainEventMessage,GenericEventMessage,GenericTrackedDomainEventMessage,GenericTrackedEventMessage
Represents a Message wrapping an Event, which is represented by its payload. An Event is a representation of an
occurrence of an event (i.e. anything that happened any might be of importance to any other component) in the
application. It contains the data relevant for components that need to act based on that event.
- Since:
- 2.0
- Author:
- Allard Buijze
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this EventMessage with it MetaData merged with the givenmetaData.Returns the identifier of this event.Returns the timestamp of this event.withMetaData(Map<String, ?> metaData) Returns a copy of this EventMessage with the givenmetaData.Methods inherited from interface org.axonframework.messaging.Message
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Method Details
-
getIdentifier
String getIdentifier()Returns the identifier of this event. The identifier is used to define the uniqueness of an event. Two events may contain similar (or equal) payload and timestamp, if the EventIdentifiers are different, they both represent a different occurrence of an Event. If two messages have the same identifier, they both represent the same unique occurrence of an event, even though the resulting view may be different. You may not assume two messages are equal (i.e. interchangeable) if their identifier is equal. For example, an AddressChangeEvent may occur twice for the same Event, because someone moved back to the previous address. In that case, the Event payload is equal for both EventMessage instances, but the Event Identifier is different for both.- Specified by:
getIdentifierin interfaceMessage<T>- Returns:
- the identifier of this event.
-
getTimestamp
Instant getTimestamp()Returns the timestamp of this event. The timestamp is set to the date and time the event was reported.- Returns:
- the timestamp of this event.
-
withMetaData
Returns a copy of this EventMessage with the givenmetaData. The payload,TimestampandIdentifierremain unchanged.- 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 EventMessage with it MetaData merged with the givenmetaData. The payload,TimestampandIdentifierremain unchanged.- Specified by:
andMetaDatain interfaceMessage<T>- Parameters:
metaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-