Interface IOrchestrationRouter<TLogic>

Extends the basic orchestration router interface with additional configuration options, including a description, logging capabilities, initial context schema validation, and optional routing metadata enhancement.

interface IOrchestrationRouter<TLogic> {
    description?: string;
    enableRoutingMetaData?: boolean;
    initialContextZodSchema: ZodObject<any, UnknownKeysParam, ZodTypeAny, {}, {}>;
    locking?: "write" | "read-write";
    logger?: Logger;
    name: string;
    onSnapshot?: ((processId, snapshot) => void);
    raiseError?: {
        onInvalidOrchestratorName: boolean;
    };
    statemachine: OrchestrationMachineWithVersion<TLogic>[];
    storageManager: ILockableStorageManager;
}

Type Parameters

  • TLogic extends AnyActorLogic

    Specifies the logic type governing the orchestration's behavior.

Hierarchy (view full)

Properties

description?: string

Optional descriptive text about the orchestration router.

enableRoutingMetaData?: boolean

Controls the inclusion of to and redirectto fields in output CloudEvents.

  • true: Enables routing metadata, allowing dynamic event targeting.
  • false (default): Disables routing metadata, with to and redirectto fields nullified. Use sparingly, as orchestrators typically target services dynamically without preset destinations.
initialContextZodSchema: ZodObject<any, UnknownKeysParam, ZodTypeAny, {}, {}>

Schema for validating the initial context data, utilizing Zod for schema definition.

Type declaration

    Type declaration

      locking?: "write" | "read-write"

      Dictates the locking strategy for storage operations to manage concurrent access.

      • "write": Only write operations acquire locks.
      • "read-write": Both read and write operations acquire locks.
      logger?: Logger

      Optional logger function for accessing router logs, facilitating debugging and monitoring.

      name: string

      Unique name for the orchestrator, used in constructing event handler topics.

      onSnapshot?: ((processId, snapshot) => void)

      Optional function to handle snapshots, providing insights into the orchestration's state at specific points.

      Type declaration

        • (processId, snapshot): void
        • Optional function to handle snapshots, providing insights into the orchestration's state at specific points.

          Parameters

          • processId: string

            Identifies the orchestration process.

          • snapshot: SnapshotFrom<TLogic>

            Captures the current state of the orchestration.

          Returns void

      Param: processId

      Identifies the orchestration process.

      Param: snapshot

      Captures the current state of the orchestration.

      raiseError?: {
          onInvalidOrchestratorName: boolean;
      }

      An optional configuration object for the router that specifies which error events should be triggered under certain conditions. This allows for fine-grained control over error handling, enabling applications to respond to specific error scenarios more effectively.

      Type declaration

      • onInvalidOrchestratorName: boolean

        Determines whether an error should be raised when there is a mismatch between the orchestrator name specified in an event and the expected orchestrator name.

        When set to true, an error event is triggered if the name of the orchestrator that constructed the subject of the event does not match the orchestrator name that the router was expecting. This can be useful for detecting and responding to configuration errors or unauthorized attempts to trigger events.

        Setting this flag to false disables the error check, which might be suitable in environments where the orchestrator name is dynamic or verification is handled elsewhere.

      A list of state machine logics with their corresponding versions, dictating the orchestration's behavior.

      storageManager: ILockableStorageManager

      Manages state persistence of the orchestration, ensuring concurrent access control. It must adhere to the ILockableStorageManager interface from unified-serverless-storage.

      Generated using TypeDoc