SimpleDomainEvent

data class SimpleDomainEvent<T : Any>(val id: String = generateGlobalId(), val header: Header = DefaultHeader.empty(), val body: T, val aggregateId: AggregateId, val ownerId: String = OwnerId.DEFAULT_OWNER_ID, val spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, val version: Int, val sequence: Int = DEFAULT_EVENT_SEQUENCE, val revision: String = DEFAULT_REVISION, val commandId: String, val name: String = body.javaClass.toName(), val isLast: Boolean = true, val createTime: Long = System.currentTimeMillis()) : DomainEvent<T> , NamedAggregate

Simple implementation of DomainEvent.

This data class provides a concrete implementation of the DomainEvent interface, representing a domain event with all required metadata and payload information.

Type Parameters

T

The type of the event body

See also

Constructors

Link copied to clipboard
constructor(id: String = generateGlobalId(), header: Header = DefaultHeader.empty(), body: T, aggregateId: AggregateId, ownerId: String = OwnerId.DEFAULT_OWNER_ID, spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, version: Int, sequence: Int = DEFAULT_EVENT_SEQUENCE, revision: String = DEFAULT_REVISION, commandId: String, name: String = body.javaClass.toName(), isLast: Boolean = true, createTime: Long = System.currentTimeMillis())

Creates a new SimpleDomainEvent with the specified properties

Properties

Link copied to clipboard
open override val aggregateId: AggregateId

The aggregate ID this event belongs to

Link copied to clipboard
open override val body: T

The event payload data

Link copied to clipboard
open override val commandId: String

The ID of the command that triggered this event

Link copied to clipboard
open override val createTime: Long

The timestamp when the event was created (default: current time)

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 (default: generated global ID)

Link copied to clipboard
open override val isLast: Boolean

Whether this is the last event in the stream (default: true)

Link copied to clipboard
open override val name: String

The event name (default: derived from body class name)

Link copied to clipboard
open override val ownerId: String

The owner identifier (default: DEFAULT_OWNER_ID)

Link copied to clipboard
open override val revision: String

The event schema revision (default: DEFAULT_REVISION)

Link copied to clipboard
open override val sequence: Int

The sequence number within the event stream (default: DEFAULT_EVENT_SEQUENCE)

Link copied to clipboard
open override val spaceId: SpaceId

The space identifier (default: DEFAULT_SPACE_ID)

Link copied to clipboard
open override val version: Int

The aggregate version when this event was created