BPMN Server API Reference

website·Indexed 30 days ago

https://bpmnserver.github.io/bpmn-server/

API documentation for bpmn-server, featuring core classes and interfaces for process execution and management. Key components include the BPMNServer main class, Engine for process orchestration, Execution for managing process instances, and various interfaces such as IBPMNServer, IEngine, and ICacheManager.

Tokens
69.9K
Snippets
567
Records
725
Agent score
75%

What's inside BPMN Server

  1. Overview of bpmn-server scripting environment

    Scripting in bpmn-server uses the Node.js JavaScript engine. Scripts have full access to the running workflow and application logic via three primary entry points: AppDelegate (general entry point), AppServices (responds to Service Tasks), and AppUtils (general purpose utility class).
  2. Overview of bpmn-server components

    bpmn-server provides a Workflow component based on Business Process Model and Notation (BPMN) for Node.js applications. It features out-of-the-box state persistence and variables, supporting concurrency across Node.js clusters and process instances for long-running business processes or scheduled tasks. The ecosystem consists of two primary packages:

    • bpmn-web: A full web application containing modeling and administration tools.
    • bpmn-client: A lightweight library for remote connections to the server via API.
  3. Overview of BPMN Workflow Execution

    Workflow execution is based on BPMN 2.0 standards and model logic. It is enhanced by extensions that allow scripting and application integration. During execution, the engine invokes Model Listeners and Application Listeners. Key components that participate in execution include Event Listeners, Scripts, Services, and the AppDelegate. The execution engine is accessible via the engine API.
  4. TerminateBehaviour Class Overview

    The TerminateBehaviour class is used to perform termination actions within a BPMN process. It extends the base Behaviour class and is designed to scan definitions and insert itself to execute specific actions as required by the process flow.
    // Example instantiation
    const termination = new TerminateBehaviour(node, definition);
  5. Use BehaviourLoader to manage BPMN behaviors

    The BehaviourLoader class provides a mechanism to register behavior-loading functions and apply them to BPMN nodes. It maintains a static list of behaviors, where each behavior consists of a name and a function that processes a node and its definition.
    const loader = new BehaviourLoader();
  6. Understand Boundary Event behavior in bpmn-server

    Boundary Events in bpmn-server follow these lifecycle rules:

    • They start simultaneously with their owner Activity.
    • They are automatically cancelled when the owner activity is completed.
    • Interrupting Boundary Events: When these events fire/complete, they cancel (interrupt) the owner activity.
    • Non-Interrupting Boundary Events: These fire without impacting the state or execution of the owner activity.
  7. Use InstanceLocker to manage process instance locks

    The InstanceLocker class provides mechanisms to lock, release, and manage locks for process instances within the bpmn-server datastore. It ensures that specific instances are not processed concurrently by multiple workers.
    const locker = new InstanceLocker(dataStore);
  8. TimerBehaviour Class Overview

    The TimerBehaviour class extends Behaviour and is used to perform timer-related actions within a BPMN process. It scans definitions and inserts itself to manage time-based events using durations, cycles, or specific dates.
    // Hierarchy: Behaviour ↳ TimerBehaviour
  9. Use DefaultAppDelegate to handle BPMN workflow events

    The DefaultAppDelegate class is used to respond to various events and services within the bpmn-server. It implements the IAppDelegate interface and is responsible for: receiving all workflow events, handling service calls, processing message and signal calls, and executing scripts.
    const delegate = new DefaultAppDelegate(server);