public abstract class EventUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> DomainEventMessage<T> |
asDomainEventMessage(EventMessage<T> eventMessage)
Deprecated.
since this method is not used for external use. This method is intended to deduce whether a given
EventMessage is a DomainEventMessage and if not, push it into being one by adjusting the fields.
However, this is only intended to simplify the storage of events. This does not make a regular EventMessage a DomainEventMessage by any means. The only way to have a true DomainEventMessage is by publishing events from within an Aggregate, by using the AggregateLifecycle
operations. |
static <T> TrackedEventMessage<T> |
asTrackedEventMessage(EventMessage<T> eventMessage,
TrackingToken trackingToken)
|
static Stream<TrackedEventMessage<?>> |
upcastAndDeserializeTrackedEvents(Stream<? extends TrackedEventData<?>> eventEntryStream,
Serializer serializer,
EventUpcaster upcasterChain)
Upcasts and deserializes the given
eventEntryStream using the given serializer and upcasterChain . |
public static <T> TrackedEventMessage<T> asTrackedEventMessage(EventMessage<T> eventMessage, TrackingToken trackingToken)
EventMessage
to a TrackedEventMessage
using the given trackingToken
. If the
event is a DomainEventMessage
the message will be converted to a GenericTrackedDomainEventMessage
, otherwise a GenericTrackedEventMessage
is returned.T
- the payload type of the eventeventMessage
- the message to converttrackingToken
- the tracking token to use for the resulting message@Deprecated public static <T> DomainEventMessage<T> asDomainEventMessage(EventMessage<T> eventMessage)
EventMessage
is a DomainEventMessage
and if not, push it into being one by adjusting the fields.
However, this is only intended to simplify the storage of events. This does not make a regular EventMessage
a DomainEventMessage
by any means. The only way to have a true DomainEventMessage
is by publishing events from within an Aggregate, by using the AggregateLifecycle
operations.EventMessage
to a DomainEventMessage
. If the message already is a DomainEventMessage
it will be returned as is. Otherwise a new GenericDomainEventMessage
is made with
null
type, aggregateIdentifier
equal to messageIdentifier
and sequence number of 0L.T
- The type of payload in the messageeventMessage
- the input event messagepublic static Stream<TrackedEventMessage<?>> upcastAndDeserializeTrackedEvents(Stream<? extends TrackedEventData<?>> eventEntryStream, Serializer serializer, EventUpcaster upcasterChain)
eventEntryStream
using the given serializer
and upcasterChain
.
The list of events returned contains lazy deserializing events for optimization purposes. Events represented with
unknown classes are ignored if skipUnknownTypes
is true
eventEntryStream
- the stream of entries containing the data of the serialized eventserializer
- the serializer to deserialize the event withupcasterChain
- the chain containing the upcasters to upcast the events withCopyright © 2010–2024. All rights reserved.