DomainEventStream

Domain Event Stream interface representing a sequence of domain events.

A domain event stream contains a collection of domain events that were generated as a result of a single command execution. The relationship is 1:1 between event streams and command IDs.

Key requirements:

  • Events must be sorted in ascending order by version number

  • Version numbers must be monotonically increasing

  • All events in a stream belong to the same aggregate

  • Events are immutable once created

See also

Inheritors

Properties

Link copied to clipboard
abstract override val aggregateId: AggregateId
Link copied to clipboard
abstract val size: Int

Functions

Link copied to clipboard

Determines if this event stream should be ignored during event sourcing.

Link copied to clipboard

Converts a DomainEventStream to a StateEvent using the state from a ReadOnlyStateAggregate.

fun <S : Any> DomainEventStream.toStateEvent(state: S, firstOperator: String = header.operator.orEmpty(), firstEventTime: Long = createTime, tags: AbacTags = EMPTY_ABAC_TAGS, deleted: Boolean = false): StateEvent<S>

Converts a DomainEventStream to a StateEvent with the given state.