EventStreamRecord

class EventStreamRecord @InternalWowApi constructor(val ref: AggregateRef, val version: Int, val commandId: String, val requestId: String, val commandType: String, val commitTime: Long, val events: List<EventRecord>, val scope: Scope, val causation: Causation? = null, val headers: Map<String, String> = emptyMap(), val operator: Operator? = null, val access: Map<String, Any?>? = null, val accessVersion: Int? = if (access == null) null else version)

The events one command produced, committed together by one append: the unit of fact (documentation/designs/08-data-protocols.md §4).

  • version is the aggregate's version after this stream; the first stream of an aggregate is version 1 and each next one is exactly one more.

  • commandType is the model's name of the command that produced it (context.aggregate.Command, not a class name): a request id reused by a command of another type is told apart from a retry by it.

  • scope is the aggregate's owner and space after this commit, not the caller's: every fact carries it, so projections and query authorization read it without replaying history.

  • causation and headers come from the command: the chain it belongs to and the request facts admission kept.

  • operator comes from the command too: whose name the commit is recorded in, the primary record of an audit; null for an anonymous caller.

  • access are the aggregate's access attributes, the built-in owner and space among them, in their stored form (me.ahoo.wow.spi.access.AccessValues): those after this commit when it is appended, and then always the aggregate's current ones, which a stamp writes over its earlier streams when they change, so the events model authorizes a timeline by what the aggregate is now. Null when not stamped: a stream appended before the log recorded them, or imported without them, until a stamp gives them. accessVersion is the version they are of: the stream's own when appended with them (the default when access is given), the stamp's after a stamp, null with access. A writer of a copy of them keeps the one of the later version, which values cannot tell.

  • The schedules a decision set or cancelled are among its events, as the system events wow.ScheduleSet and wow.ScheduleCancelled, from which the built-in timers subscription derives the timer store.

  • rejection is the rejection whose events this stream holds, when a decision rejected its command with events, from the headers under REJECTION_PREFIX (wow.rejection.code, .message, .extensions); null for a commit. Its events are ordinary events of the aggregate, which projections and sagas handle as any; a retry of the command is answered with the same rejection.

Fields may be added: construct one with of; the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(ref: AggregateRef, version: Int, commandId: String, requestId: String, commandType: String, commitTime: Long, events: List<EventRecord>, scope: Scope, causation: Causation? = null, headers: Map<String, String> = emptyMap(), operator: Operator? = null, access: Map<String, Any?>? = null, accessVersion: Int? = if (access == null) null else version)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val access: Map<String, Any?>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The rejection whose events this stream holds; null for a commit (REJECTION_PREFIX).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copyWith(ref: AggregateRef = this.ref, version: Int = this.version, commandId: String = this.commandId, requestId: String = this.requestId, commandType: String = this.commandType, commitTime: Long = this.commitTime, events: List<EventRecord> = this.events, scope: Scope = this.scope, causation: Causation? = this.causation, headers: Map<String, String> = this.headers, operator: Operator? = this.operator, access: Map<String, Any?>? = this.access, accessVersion: Int? = this.accessVersion): EventStreamRecord

This EventStreamRecord with the given fields replaced: Wow's own copy, left out of the ABI.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String