An array of CloudEvent objects to be processed during the orchestration.
Optional. An array of initialization objects containing a subject (process ID) and initial context for actors.
Promise resolving to an array of CloudEvent objects to be emitted as a result of the orchestration.
Error if any cloud event lacks a subject, or if there's an overlap in subjects between events and initialization objects.
const orchestrationParams = {
statemachine: [...], // Define state machines
name: "ExampleOrchestrator", // Orchestrator name
storageManager: someStorageManager, // Storage manager for persistent actors
onOrchestrationState: (id, state) => { // middleware for handling orchestration state changes // },
onCloudEvent: (id, event) => { // middleware for handling cloud events during orchestration // },
onSnapshot: (id, snapshot) => { // callback for handling actor snapshots // },
};
const initialEvents = [
{ processId: "123", version: "v1.0", context: {} },
// ... more initialization objects
];
const cloudEvents = [
{ subject: "123", // cloud event data // },
// ... more cloud events
];
const result = await orchestrateCloudEvents(orchestrationParams, cloudEvents, initialEvents);
console.log(result.eventsToEmit); // Array of CloudEvents to be emitted
console.log(result.processContext); // Map of process IDs to their corresponding contexts
console.log(result.errors); // Array of errors encountered during orchestration
Generated using TypeDoc
Parameters for orchestrating cloud events, including state machine logic, storage manager, and middleware.