org.axonframework.domain
Interface EventMessage<T>

Type Parameters:
T - The type of payload contained in this Message
All Superinterfaces:
Message<T>, Serializable
All Known Subinterfaces:
DomainEventMessage<T>
All Known Implementing Classes:
GenericDomainEventMessage, GenericEventMessage, SerializationAwareDomainEventMessage, SerializationAwareEventMessage, SerializedDomainEventMessage, SerializedEventMessage

public interface EventMessage<T>
extends Message<T>

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:
DomainEventMessage

Method Summary
 EventMessage<T> andMetaData(Map<String,?> metaData)
          Returns a copy of this EventMessage with it MetaData merged with the given metaData.
 String getIdentifier()
          Returns the identifier of this event.
 org.joda.time.DateTime getTimestamp()
          Returns the timestamp of this event.
 EventMessage<T> withMetaData(Map<String,?> metaData)
          Returns a copy of this EventMessage with the given metaData.
 
Methods inherited from interface org.axonframework.domain.Message
getMetaData, getPayload, getPayloadType
 

Method Detail

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:
getIdentifier in interface Message<T>
Returns:
the identifier of this event.

getTimestamp

org.joda.time.DateTime 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

EventMessage<T> withMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with the given metaData. The payload, Timestamp and Identifier remain unchanged.

Specified by:
withMetaData in interface Message<T>
Parameters:
metaData - The new MetaData for the Message
Returns:
a copy of this message with the given MetaData

andMetaData

EventMessage<T> andMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with it MetaData merged with the given metaData. The payload, Timestamp and Identifier remain unchanged.

Specified by:
andMetaData in interface Message<T>
Parameters:
metaData - The MetaData to merge with
Returns:
a copy of this message with the given MetaData


Copyright © 2010-2016. All Rights Reserved.