org.axonframework.domain
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, SerializationAwareDomainEventMessage, SerializedDomainEventMessage

public interface DomainEventMessage<T>
extends EventMessage<T>

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
 DomainEventMessage<T> andMetaData(Map<String,?> metaData)
          Returns a copy of this DomainEventMessage with its 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.
 DomainEventMessage<T> withMetaData(Map<String,?> metaData)
          Returns a copy of this DomainEventMessage with the given metaData.
 
Methods inherited from interface org.axonframework.domain.EventMessage
getIdentifier, getTimestamp
 
Methods inherited from interface org.axonframework.domain.Message
getMetaData, getPayload, getPayloadType
 

Method Detail

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

Object 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

withMetaData

DomainEventMessage<T> withMetaData(Map<String,?> metaData)
Returns a copy of this DomainEventMessage with the given metaData. The payload, Timestamp and EventIdentifier, as well as the Aggregate Identifier and Sequence Number remain unchanged.

Specified by:
withMetaData in interface EventMessage<T>
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

DomainEventMessage<T> andMetaData(Map<String,?> metaData)
Returns a copy of this DomainEventMessage with its MetaData merged with the given metaData. The payload, Timestamp and EventIdentifier, as well as the Aggregate Identifier and Sequence Number remain unchanged.

Specified by:
andMetaData in interface EventMessage<T>
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.