Flowable Engine Documentation

repository·main·Indexed 27 days ago

https://github.com/flowable/flowable-engine

A high-performance BPM platform providing BPMN, CMMN, and DMN engines. It can be embedded in Java applications or run as a scalable service via Java and REST APIs. Documentation covers Public REST APIs (Process, Decision, Form, and Content), Docker base images, Kubernetes deployment via Helm or manifests, and developer tools for generating OpenAPI/Swagger specifications and client SDKs.

Tokens
173.9K
Snippets
450
Records
811
Agent score
94%

What's inside Flowable Engine

  1. Overview of IDM engine entities

    main

    The Identity Management (IDM) engine manages the following core entities in its database schema:

    • User / UserEntity: User information.
    • Group / GroupEntity: Group information.
    • MembershipEntity: Links users to groups.
    • Privilege / PrivilegeEntity: Privilege definitions (e.g., for controlling access to Flowable Modeler or Task apps).
    • PrivilegeMappingEntity: Links a user and/or group to a privilege.
    • Token / TokenEntity: Authentication tokens used by UI applications.
  2. Overview of Flowable Public REST APIs

    main

    Flowable provides four distinct groups of Public REST APIs to interact with the Flowable Engine services:

    • Process API: Provides access to most of the Flowable services.
    • Decision API: Provides access to the Flowable DMN (Decision Model and Notation) engine.
    • Form API: Provides access to the Flowable Form engine.
    • Content API: Provides access to the Flowable Content Services.
  3. Overview of Flowable Engine

    main

    Flowable is a compact and efficient workflow and Business Process Management (BPM) platform. It provides three core engines written in Java:

    • BPMN process engine: For business process modeling.
    • CMMN case engine: For case management.
    • DMN rule engine: For decision modeling.

    Flowable can be run embedded within a Java application or as a standalone service on a server, cluster, or in the cloud. It features deep integration with Spring and provides both rich Java and REST APIs for orchestrating human or system activities.

  4. Understand CMMN 1.1 in Flowable

    main

    Flowable provides support for the Case Management Model and Notation (CMMN) 1.1 standard, which is used to represent case models. The implementation includes:

    • CMMN 1.1 Modeler: A tool to create case models.
    • Java Engine: An engine capable of importing and executing CMMN 1.1 case models.
    • Demonstration UI: A user interface for executing case models, allowing users to interact with human tasks and forms.

    Key concepts include case models (the container), plan models (the structure within the case), and plan items (individual elements like human tasks, milestones, process tasks, or stages).

  5. Use None Start Events

    main

    A 'none' start event has no specific trigger (like a timer or message). It is used when a process instance is started manually via the API using startProcessInstanceByXXX methods.

    Key details:

    • Sub-processes always use a none start event.
    • If a process has multiple message start events and a single none start event, calling startProcessInstanceByKey or startProcessInstanceById will target the none start event.
    • If a process has multiple message start events but no none start event, calling startProcessInstanceByKey or startProcessInstanceById will throw an exception.
  6. Understand Flowable integration options

    main

    Flowable is a lightweight Java-based business process engine for BPMN 2.0. You can integrate it into your architecture in several ways:

    1. Embedded Engine: Include the Flowable library as a JAR in your Java environment (Java SE, Spring, Tomcat, Jetty, JBoss, WebSphere, etc.). This allows you to call the engine's APIs directly from your code.
    2. REST API: Communicate with the engine over HTTP using the Flowable REST API.
    3. Flowable Applications: Use out-of-the-box UIs such as Flowable Modeler, Flowable Admin, Flowable IDM, and Flowable Task for process management.
  7. Understand Flowable versioning and compatibility

    main

    Flowable uses a MAJOR.MINOR.MICRO versioning strategy:

    • MAJOR: Core engine evolutions.
    • MINOR: New features and new APIs.
    • MICRO: Bug fixes and improvements.

    Compatibility Guarantees:

    • Flowable aims for source compatibility (applications build without error and semantics remain unchanged) and binary compatibility (JARs can be dropped in as replacements) during MINOR and MICRO releases for all non-internal classes.
    • API Deprecation: If an API change is introduced in a MINOR release, the old API is kept and marked with @Deprecated. It is removed two MINOR versions later.
  8. Understand the CMMN Engine Architecture

    main

    The CMMN engine is part of the Flowable ecosystem and shares core services with other engines (like BPMN). This shared architecture allows for unified management of tasks, variables, identity, and jobs. When multiple engines are used together, they share resources, database transactions span multiple engine operations, and lookup caches are common.

    Core Components

    • CmmnEngine: The main entry point, created from a CmmnEngineConfiguration (via file or programmatically).
    • CMMN Services: The engine provides access to several key APIs:
      • CmmnRepositoryService
      • CmmnRuntimeService
      • CmmnTaskService
      • CmmnHistoryService
      • CmmnManagementService
    • Command Execution: Every API method is converted into a Command, passed to a CommandExecutor, and processed through CommandInterceptors (which handle tasks like transactions).
    • Agenda & Operations: Commands typically plan a CmmnOperation on the CmmnEngineAgenda. The agenda executes these operations sequentially until none remain.
    • Plan Item Instances: Unlike BPMN, CMMN relies heavily on data changes triggering evaluations. The engine tracks the state of 'live' plan items through PlanItemInstance objects, which follow a strict state life cycle.
  9. Automatic removal of event listeners

    main

    The Flowable engine automatically detects and terminates event listeners (user or timer) that are no longer useful to prevent orphaned listeners.

    Removal triggers include:

    • When all tasks/plan items that a listener is waiting for (or that would trigger the listener's purpose) are completed and the stage/case reaches a state where the event can no longer be listened to.
    • When an event listener is referenced by an entry sentry, and the target of that sentry is no longer active.
    • When a competing listener (e.g., a timer vs. a user event) is triggered first, the other is removed if it is not referenced elsewhere.

    Note on future plan items: The engine does not remove a listener if it is still needed for plan items that have not yet been created, provided their parent stage is in a non-terminal state.

  10. Understand CMMN Sentry Evaluation

    main

    Sentries in CMMN are used to declaratively configure when plan item instances activate or stop. The Flowable CMMN engine evaluates sentries whenever state changes occur in a case instance, such as:

    • Starting a case instance.
    • Triggering a wait state plan item (e.g., a human task) to continue.
    • Changing case instance variables (added, updated, or deleted).
    • Changing the state of a plan item instance (e.g., via RuntimeService termination or manual start).
    • Manually triggering evaluation via RuntimeService#evaluateCriteria.

    The engine continues to schedule evaluations as long as changes occur. Once the state becomes stable (no more changes), evaluation stops.

  11. Use the Flowable Docker base image

    main

    The Flowable Docker base image is built upon azul/zulu-openjdk-alpine:21-jre-latest. It is designed to provide a secure environment for running Flowable applications by including a non-root user and utility scripts.

    Key features include:

    • Non-root execution: Includes a flowable:flowable user, allowing you to 'step down' from root when executing Flowable applications to improve security.
    • Utilities: Includes su-exec for switching users and ttf-dejavu fonts.
    • Wait script: Includes wait-for-something.sh to assist with container startup orchestration (e.g., waiting for a database to be ready).
  12. Understand Async Executor job types

    main

    Flowable uses an Async Executor to handle two primary types of background jobs:

    1. Timers: Associated with events like boundary events on user tasks. They are stored in the ACT_RU_TIMER_JOB table with a due date. A background thread periodically checks for due timers and converts them into async jobs.
    2. Async Continuations: Created when a service task is configured with the flowable:async="true" attribute. These are inserted into the ACT_RU_JOB table. If the async executor is enabled, these jobs are immediately locked to prevent duplicate execution.

    Error Handling & Retries:

    • If a job fails, it is transformed into a timer job with a due date to be retried later.
    • After a configurable number of failed retries (asyncExecutorNumberOfRetries), the job is moved to the ACT_RU_DEADLETTER_JOB table for manual administrator intervention.