ExecutionSagaContext

class ExecutionSagaContext @InternalWowApi constructor(val executionId: ExecutionId, event: StateEvent<*>, val ids: Ids, commandTypes: CommandTypes, codec: EventCodec = EventCodec(), calls: CommandCalls = CommandCalls.NONE, contextQueries: ContextQueries = ContextQueries.NONE, sends: SagaSends? = null) : SagaContext

The context of a saga's handler for one execution of the commit event. Each execution, a retry included, gets a new one, and each command it derives is keyed by what it asks (derivedId): its target, its command type and its business key or its occurrence among the commands of this execution with both. Handling the commit again derives the same request for each command it derives again, in whatever order, which the kernel does not decide twice (it deduplicates by request id). A domain module's tests build one to call a saga directly.

Its schedules are commands too: schedule and cancel record the system commands wow.schedule.Set and wow.schedule.Cancel to their target, keyed with the other commands, the command they schedule named by commandTypes and written by codec; commandsOf puts them after the returned ones.

Its ids are the node's generators; a domain module's test gives fixed ones.

Its synchronous calls go through calls: the node's client of the other contexts' command gateways, an answer in a domain module's test. Its queries are contextQueries' of the commit's tenant.

Constructors

Link copied to clipboard
constructor(executionId: ExecutionId, event: StateEvent<*>, ids: Ids, commandTypes: CommandTypes, codec: EventCodec = EventCodec(), calls: CommandCalls = CommandCalls.NONE, contextQueries: ContextQueries = ContextQueries.NONE, sends: SagaSends? = null)
constructor(executionId: ExecutionId, event: StateEvent<*>, ids: Ids = IdGenerators.DEFAULT)

The context of the execution executionId of the commit event, deriving its ids from ids.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val executionId: ExecutionId
Link copied to clipboard
open override val ids: Ids
Link copied to clipboard
open override val queries: SubscriptionQueries

Functions

Link copied to clipboard
open suspend override fun call(request: CommandRequest<*>): CommandResult
Link copied to clipboard
open override fun cancel(key: String, target: AggregateRef)
Link copied to clipboard

The commands of requests, in order, then those schedule and cancel recorded, in the order of the calls.

Link copied to clipboard
open override fun schedule(key: String, rule: ScheduleRule, request: CommandRequest<*>)