T
- The type of payload contained in this Messagepublic class GenericTrackedDomainEventMessage<T> extends GenericDomainEventMessage<T> implements TrackedEventMessage<T>
DomainEventMessage
that is also a TrackedEventMessage
.clock
Modifier | Constructor and Description |
---|---|
|
GenericTrackedDomainEventMessage(TrackingToken trackingToken,
DomainEventMessage<T> delegate)
Initialize a DomainEventMessage originating from an aggregate.
|
protected |
GenericTrackedDomainEventMessage(TrackingToken trackingToken,
String type,
String aggregateIdentifier,
long sequenceNumber,
Message<T> delegate,
Instant timestamp)
Initialize a DomainEventMessage originating from an aggregate.
|
|
GenericTrackedDomainEventMessage(TrackingToken trackingToken,
String type,
String aggregateIdentifier,
long sequenceNumber,
Message<T> delegate,
Supplier<Instant> timestamp)
Initialize a DomainEventMessage originating from an Aggregate using existing data.
|
Modifier and Type | Method and Description |
---|---|
GenericTrackedDomainEventMessage<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() . |
TrackingToken |
trackingToken()
Returns the
TrackingToken of the event message. |
GenericTrackedDomainEventMessage<T> |
withMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with the given
metaData . |
GenericTrackedDomainEventMessage<T> |
withTrackingToken(TrackingToken trackingToken)
Creates a copy of this message with the given
trackingToken to replace the one in this message. |
getAggregateIdentifier, getSequenceNumber, getType
asEventMessage, getTimestamp
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdentifier, getTimestamp
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
public GenericTrackedDomainEventMessage(TrackingToken trackingToken, DomainEventMessage<T> delegate)
trackingToken
- Tracking token of the eventdelegate
- Delegate domain event containing other event datapublic GenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Supplier<Instant> timestamp)
trackingToken
- Tracking token of the eventtype
- 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 supplierprotected GenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Instant timestamp)
trackingToken
- Tracking token of the eventtype
- 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 timestamppublic TrackingToken trackingToken()
TrackedEventMessage
TrackingToken
of the event message.trackingToken
in interface TrackedEventMessage<T>
public GenericTrackedDomainEventMessage<T> withMetaData(@Nonnull Map<String,?> metaData)
EventMessage
metaData
. 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 GenericDomainEventMessage<T>
metaData
- The new MetaData for the Messagepublic GenericTrackedDomainEventMessage<T> andMetaData(@Nonnull Map<String,?> metaData)
EventMessage
metaData
. 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 GenericDomainEventMessage<T>
metaData
- The MetaData to merge withprotected void describeTo(StringBuilder stringBuilder)
MessageDecorator
stringBuilder
. 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 GenericDomainEventMessage<T>
stringBuilder
- the builder to append data topublic GenericTrackedDomainEventMessage<T> withTrackingToken(TrackingToken trackingToken)
TrackedEventMessage
trackingToken
to replace the one in this message.
This method is useful in case streams are modified (combined, split), and the tokens of the combined stream are different than the originating stream.
withTrackingToken
in interface TrackedEventMessage<T>
trackingToken
- The tracking token to replaceprotected String describeType()
MessageDecorator
MessageDecorator.toString()
.
Defaults to the simple class name of the actual instance.
describeType
in class GenericDomainEventMessage<T>
Copyright © 2010–2024. All rights reserved.