MultiArvoEventHandler processes multiple event types without being bound to specific contracts. Manages event execution, telemetry tracking, and error handling for diverse event streams.

const handler = createMultiArvoEventHandler({
source: "order.handler",
executionunits: 1,
handler: async ({ event }) => {
// Handle multiple event types
}
});

Hierarchy (view full)

Constructors

Properties

executionunits: number

Computational cost metric for handler operations

Event processing function

source: string

Source identifier for event routing

spanOptions: SpanOptions

OpenTelemetry configuration

Accessors

  • get systemErrorSchema(): {
        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: string;
    }
  • System error schema configuration. Error events follow format: sys..error

    Returns {
        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: 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: string

Methods

  • Processes an event through configured handler function. Creates telemetry span, validates event destination, executes handler, and manages errors.

    Parameters

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

      Event to process

    • opentelemetry: ArvoEventHandlerOpenTelemetryOptions = ...

      Telemetry context configuration

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

    Resulting events or error events

    When event destination does not match handler source

    Other Violation error which are thrown by the event handler function