Skip to main content

Orchestration

Real integrations are often not a single step but a workflow: several packages that run in sequence, each handling one part of a larger process. Orchestration is about coordinating those packages.

Running a package from another package

The execute_package function runs one package from within another:

let data = {
source: { event: 'request-update' },
event: 'request_update',
module: 'requests',
varname: 'request',
initial_id: 15,
};

let result = execute_package('do_on_request_update', data);
log('result', result);

This is fundamentally different from including a library. A library's code runs as part of the using package. A package run with execute_package is executed on its own: it gets its own standard variables, either supplied by the caller in the data object, as above, or taken from the calling package, and returns a result to the caller.

Composing packages this way lets you break a large process into smaller, independently meaningful packages and keep each one small and maintainable, while a higher-level package coordinates them.