WorkflowContext
WorkflowContext =
object
Defined in: core/src/core/context.ts:91
Execution context for workflow event processing.
The workflow context provides the runtime environment for executing handlers and managing event flow. It offers access to the event stream, abort signals, and methods for sending events within the workflow.
Example
Section titled “Example”// Use the current context (first parameter inside a handler)const \{ sendEvent, stream, signal \} = context;
// Send eventssendEvent( ProcessEvent.with(\{ step: 'validation' \}), LogEvent.with(\{ message: 'Processing started' \}));
// Access the event streamawait stream.filter(CompletionEvent).take(1).toArray();
// Check for cancellationif (signal.aborted) \{ throw new Error('Operation cancelled');\}
Properties
Section titled “Properties”sendEvent()
Section titled “sendEvent()”sendEvent: (…
events
) =>void
Defined in: core/src/core/context.ts:110
Sends one or more events into the workflow for processing. Events will be delivered to all matching handlers asynchronously.
Parameters
Section titled “Parameters”events
Section titled “events”…WorkflowEventData
<any
>[]
Event data instances to send
Returns
Section titled “Returns”void
__internal__call_send_event
Section titled “__internal__call_send_event”__internal__call_send_event:
Subscribable
<[WorkflowEventData
<any
>,HandlerContext
],void
>
Defined in: core/src/core/context.ts:119
__internal__property_inheritance_handlers?
Section titled “__internal__property_inheritance_handlers?”
optional
__internal__property_inheritance_handlers:Map
<string
,InheritanceTransformer
>
Defined in: core/src/core/context.ts:123
Accessors
Section titled “Accessors”stream
Section titled “stream”Get Signature
Section titled “Get Signature”get stream():
WorkflowStream
<WorkflowEventData
<any
>>
Defined in: core/src/core/context.ts:96
Stream of all events flowing through this workflow context. Can be used to listen for specific events or create reactive processing chains.
Returns
Section titled “Returns”WorkflowStream
<WorkflowEventData
<any
>>
signal
Section titled “signal”Get Signature
Section titled “Get Signature”get signal():
AbortSignal
Defined in: core/src/core/context.ts:102
Abort signal that indicates if the workflow has been cancelled. Handlers should check this periodically for long-running operations.
Returns
Section titled “Returns”AbortSignal