Orchestrates state machine execution and lifecycle management.

Coordinates machine resolution, state persistence, event processing, and error handling for Arvo's event-driven orchestration workflows. Manages the complete lifecycle from event receipt through machine execution to emitting result events.

Implements

Constructors

Properties

executionEngine: IMachineExectionEngine

Engine responsible for executing state machine logic

executionunits: number

Computational cost metric associated with event handling operations

Registry containing available state machines

OpenTelemetry span configuration for observability

syncEventResource: SyncEventResource<MachineMemoryRecord>

Resource manager for state synchronization and memory access

systemErrorDomain?: (null | string)[] = undefined

Optional domains for routing system error events

Accessors

  • get requiresResourceLocking(): boolean
  • Whether this orchestrator requires resource locking for concurrent safety

    Returns boolean

  • get systemErrorSchema(): {
        domain: undefined | (null | string)[];
        schema: ZodObject<{
            errorMessage: ZodString;
            errorName: ZodString;
            errorStack: ZodNullable<ZodString>;
        }, "strip", ZodTypeAny, {
            errorMessage: string;
            errorName: string;
            errorStack: null | string;
        }, {
            errorMessage: string;
            errorName: string;
            errorStack: null | string;
        }>;
        type: any;
    }
  • Provides access to the system error event schema configuration.

    Returns {
        domain: undefined | (null | string)[];
        schema: ZodObject<{
            errorMessage: ZodString;
            errorName: ZodString;
            errorStack: ZodNullable<ZodString>;
        }, "strip", ZodTypeAny, {
            errorMessage: string;
            errorName: string;
            errorStack: null | string;
        }, {
            errorMessage: string;
            errorName: string;
            errorStack: null | string;
        }>;
        type: any;
    }

    • domain: undefined | (null | string)[]
    • schema: ZodObject<{
          errorMessage: ZodString;
          errorName: ZodString;
          errorStack: ZodNullable<ZodString>;
      }, "strip", ZodTypeAny, {
          errorMessage: string;
          errorName: string;
          errorStack: null | string;
      }, {
          errorMessage: string;
          errorName: string;
          errorStack: null | string;
      }>
    • type: any

Methods

  • Executes state machine orchestration for an incoming event.

    Performs the complete orchestration workflow: resolves the appropriate machine, validates input, executes the machine logic, processes emitted events, and persists the new state. Handles both new orchestrations and continuation of existing ones.

    For violation errors (transaction, execution, contract, config), the error is thrown to enable retry mechanisms. For non-violation errors, system error events are emitted to the workflow initiator, and the orchestration enters a terminal failure state.

    Parameters

    • event: ArvoEvent<Record<string, any>, Record<string,
          | null
          | string
          | number
          | boolean>, string>

      The incoming event triggering orchestration

    • Optionalopentelemetry: ArvoEventHandlerOpenTelemetryOptions

      Optional OpenTelemetry configuration for tracing

    Returns Promise<{
        events: ArvoEvent<Record<string, any>, Record<string,
            | null
            | string
            | number
            | boolean>, string>[];
    }>

    Object containing emitted events from the orchestration or system errors

    When lock acquisition or state operations fail (retriable)

    When event data doesn't match contract schema (retriable)

    When machine resolution fails or version is missing (retriable)

    When workflow execution encounters critical errors defined by the handler developer