SimpleDomainEventStream

data class SimpleDomainEventStream(val id: String = generateGlobalId(), val requestId: String, val header: Header = DefaultHeader.empty(), val body: List<DomainEvent<*>>) : DomainEventStream, Iterable<DomainEvent<*>>

Simple implementation of DomainEventStream.

This data class provides a concrete implementation of the DomainEventStream interface, containing a list of domain events with associated metadata.

Parameters

id

The stream ID

requestId

The request ID

header

The message header

body

The list of domain events (must not be empty)

See also

Throws

if the event list is empty

Constructors

Link copied to clipboard
constructor(id: String = generateGlobalId(), requestId: String, header: Header = DefaultHeader.empty(), body: List<DomainEvent<*>>)

Creates a new SimpleDomainEventStream

Properties

Link copied to clipboard
open override val aggregateId: AggregateId

The aggregate ID (derived from the first event)

Link copied to clipboard
open override val aggregateName: String

The aggregate name (derived from aggregateId)

Link copied to clipboard
open override val body: List<DomainEvent<*>>

The list of domain events in this stream

Link copied to clipboard
open override val commandId: String

The command ID (derived from the first event)

Link copied to clipboard
open override val contextName: String

The bounded context name (derived from aggregateId)

Link copied to clipboard
open override val createTime: Long

The creation timestamp (derived from the first event)

Link copied to clipboard
open override val header: Header

The message header containing metadata (default: empty header)

Link copied to clipboard
open override val id: String

The unique identifier of this event stream (default: generated global ID)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val ownerId: String

The owner ID (derived from the first event)

Link copied to clipboard
open override val requestId: String

The request ID that initiated this event stream

Link copied to clipboard
open override val size: Int

The number of events in the stream

Link copied to clipboard
open override val version: Int

The aggregate version (derived from the first event)

Functions

Link copied to clipboard
fun NamedAggregate.aggregateId(id: String = generateId(), tenantId: String = TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this NamedAggregate with the specified parameters.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate.

Link copied to clipboard

Converts this NamedAggregate to its corresponding AggregateMetadata.

Link copied to clipboard
open override fun copy(): DomainEventStream
Link copied to clipboard

Generates a unique ID string for this NamedAggregate.

Link copied to clipboard
fun NamedBoundedContext.getContextAlias(boundedContext: BoundedContext? = MetadataSearcher.metadata.contexts[contextName]): String
Link copied to clipboard

Gets the context alias prefix for this bounded context.

Link copied to clipboard

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

Link copied to clipboard

Checks if the named aggregate is available locally at runtime.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open operator override fun iterator(): Iterator<DomainEvent<*>>
Link copied to clipboard
fun Message<*, *>.match(function: FunctionInfo): Boolean

Checks if this message matches the given function for compensation purposes.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate, throwing an exception if not found.

Link copied to clipboard

Sorts an iterable collection based on Order annotations and dependencies.

Link copied to clipboard

Extension function to convert a NamedAggregate to an EventNamedAggregate.

Link copied to clipboard
fun AggregateIdCapable.toGroupKey(parallelism: Int = DEFAULT_PARALLELISM): Int

Computes a grouping key for parallel processing based on the aggregate ID.

Link copied to clipboard

Converts this NamedAggregate to its string representation.

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, deleted: Boolean = false): StateEvent<S>

Converts a DomainEventStream to a StateEvent with the given state.

Link copied to clipboard

Converts this NamedAggregate to a string representation using the context alias.

Link copied to clipboard
open fun withHeader(additionalSource: Map<String, String>): DomainEventStream
open fun withHeader(key: String, value: String): DomainEventStream
Link copied to clipboard