Class ArvoOrchestrator

Orchestrates state machine execution and lifecycle management. Handles machine resolution, state management, event processing and error handling.

Hierarchy

  • default
    • ArvoOrchestrator

Constructors

Properties

executionEngine: IMachineExectionEngine
executionunits: number
requiresResourceLocking: boolean

Accessors

  • get source(): any
  • Gets the source identifier for this orchestrator

    Returns any

  • get systemErrorSchema(): ArvoContractRecord
  • Gets the error schema for this orchestrator

    Returns ArvoContractRecord

Methods

  • Acquires a lock on the event subject. Skip if sequential processing is enabled.

    Parameters

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

    Returns Promise<AcquiredLockStatusType>

    If lock acquisition fails

  • Creates emittable event from execution result

    Parameters

    • event: EnqueueArvoEventActionParam

      Source event to emit

    • machine: ArvoMachine<any, any, any, any, any>

      Machine that generated event

    • otelHeaders: OpenTelemetryHeaders

      OpenTelemetry headers

    • orchestrationParentSubject: null | string

      Parent orchestration subject

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

      Original triggering event

    Returns ArvoEvent<Record<string, any>, Record<string,
        | null
        | string
        | number
        | boolean>, string>

    On schema/contract mismatch

    On invalid parentSubject$$ format

  • Core orchestration method that executes state machines in response to events. Manages the complete event lifecycle:

    1. Acquires lock and state
    2. Validates events and contracts
    3. Executes state machine
    4. Persists new state
    5. Generates response events with domain-based segregation

    Parameters

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

      Event triggering the execution

    • opentelemetry: ArvoEventHandlerOpenTelemetryOptions = ...

      OpenTelemetry configuration

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

    Object containing default domained events, all event domains, and domain-segregated event buckets

    Lock/state operations failed

    Invalid event structure/flow

    Schema/contract mismatch

    Missing/invalid machine version

  • If the machine execution session acquired the lock release the lock before closing. Since the expectation from the machine memory is that there is optimistic locking and the lock has expiry time then swallowing is not an issue rather it avoid unnecessary errors

    Parameters

    • event: ArvoEvent<Record<string, any>, Record<string,
          | null
          | string
          | number
          | boolean>, string>
    • acquiredLock: null | AcquiredLockStatusType
    • span: Span

    Returns Promise<"ERROR" | "NOOP" | "RELEASED">

  • Parameters

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

    Returns void