Type alias OnOrchestrationEvent

OnOrchestrationEvent: ((event) => {
    data?: Record<string, any>;
    type: string;
})

Middleware function type for processing CloudEvents. This function takes a CloudEvent and returns an object containing the event's type, and optionally, additional event-specific data.

Type declaration

    • (event): {
          data?: Record<string, any>;
          type: string;
      }
    • Parameters

      • event: CloudEvent<Record<string, any>>

        The CloudEvent to be processed.

      Returns {
          data?: Record<string, any>;
          type: string;
      }

      • Optional data?: Record<string, any>
      • type: string

Returns

An object containing the type of the event, and optionally, additional data. The type ideally must be the topic of the event e.g. cmd.books.fetch, evt.books.fetch.success, notif.orch.done

Example

// Example middleware function for processing CloudEvents.
const onOrchestrationEvent: OnOrchestrationEvent = (event) => {
return {
type: 'cmd.books.fetch',
data: { bookId: event.data.bookId },
};
};

Generated using TypeDoc