Skip to content

About

Flowable BPMN engine pass-through resources, HTTP client and CLI for API Platform / Symfony.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

dmstr/flowable-bundle

Reusable Symfony bundle that exposes a Flowable BPMN engine as Doctrine-less API Platform pass-through resources, a per-request HTTP client and matching flowable:* CLI commands.

The bundle owns no database tables: every resource reads from and writes to a remote Flowable REST engine at request time. Connection details (base URL and credentials) are resolved per request from an ApiConfiguration of type flowable (provided by dmstr/api-configuration-bundle).

Requirements

  • PHP >= 8.5
  • Symfony 7
  • API Platform 4, at least 4.3.18 (earlier releases do not enforce security on MCP tools)
  • dmstr/api-configuration-bundle ^0.9 (and doctrine/orm ^3)
  • dmstr/api-platform-utils-bundle ^0.8 (marks the custom actions in the Hydra documentation)
  • A permission voter in the application that maps the flowable:* permissions to its roles
  • A reachable Flowable REST engine (flowable-rest)
  • ext-pcntl — only for flowable:external-worker:run as a long-lived process, where it enables the graceful shutdown described under External worker tasks. Not a hard dependency: without it the command runs, it just cannot react to SIGTERM.

Installation

composer require dmstr/flowable-bundle

If you do not use a Symfony Flex recipe that registers the bundle, add it to config/bundles.php:

return [
    // ...
    Dmstr\Flowable\FlowableBundle::class => ['all' => true],
];

The bundle is self-wiring: it ships its own service definitions (FlowableBundle::loadExtension()), registers a dedicated flowable Monolog channel and needs no entry in the application's services.yaml. API Platform discovers the resource classes automatically from src/ApiResource.

Configuration

Create an ApiConfiguration of type flowable. Its configJson is validated against schema.json:

{
    "base_url": "http://flowable-rest:8080/flowable-rest/service",
    "auth_type": "basic",
    "username": "rest-admin",
    "password": "..."
}

auth_type is either basic (requires username + password) or bearer (requires token).

password and token are marked writeOnly in the schema, so dmstr/api-configuration-bundle stores them encrypted at rest and returns them masked as ******** on read; sending the mask back on update keeps the stored value. This requires a configured encryption key (CREDENTIALS_ENCRYPTION_KEY, see the api-configuration-bundle documentation). FlowableClientLocator decrypts them only to build the client; if decryption fails, the request fails with a SecretEncryptionException instead of sending the ciphertext to the engine.

Selecting a configuration

Without a selector, the bundle uses the only active configuration of type flowable; with none or several it answers 400 and asks for a selector. An explicit selector (apiConfiguration as a string in the query string, as a string or {"uuid": "…"} as body property and MCP argument, and --api-configuration of the commands) is the first 8 characters or the full UUID, lowercase, of exactly one active configuration of type flowable, for example 0a1b2c3d. Longer or shorter prefixes, uppercase, an unknown id, an inactive configuration, another type and a prefix shared by two configurations all get the same 400 (apiConfiguration does not select an active Flowable API configuration. …), which names no other configuration; where a JSON body or MCP arguments are validated against their schema first, a malformed selector gets the schema's 422. The {"uuid": "…"} form does not work in the query string: an array there (?apiConfiguration[uuid]=…) is answered with 400. The selector is compared in PHP with the ids of the active configurations and never reaches a database query.

Bundle configuration

The config root is dmstr_flowable. Its only options switch the bundle's MCP tools (see MCP tools); all default to false, so an application that does not opt in serves no Flowable tool:

# config/packages/dmstr_flowable.yaml
dmstr_flowable:
    mcp:
        read: true    # tools with readOnlyHint: true
        write: false  # every other tool
        deploy: false # the deploy tools, in addition to write

A tool whose annotations declare readOnlyHint: true is kept only when mcp.read is on; every other tool counts as writing and is kept only when mcp.write is on. The deploy tools flowable_deploy_bundle and flowable_dmn_deploy need mcp.deploy on top of mcp.write: a deployed BPMN or DMN definition is code the engine runs (script, shell and HTTP tasks, expressions), so an agent that can deploy and start processes can execute code on the engine. A switched-off tool is removed from API Platform's resource metadata, so it is neither listed nor callable. MCP resources (McpResource entries) of the bundle's API resources are read-only and follow mcp.read; the bundle declares none yet, so a future one stays hidden until mcp.read is on. Tools and resources of other bundles and of the application are not touched.

Literal booleans only. API Platform caches its resource metadata, and the bundle filters the tools before that cache stores them, so the switches take effect when the cache is built: run bin/console cache:clear after changing a switch. For the same reason a switch must be true or false when the container is built. An environment variable placeholder such as '%env(bool:FLOWABLE_MCP_READ)%' would be frozen in the metadata cache at warmup, and changing the variable later would change nothing, so the container build fails with an error naming the switch, for a placeholder or any other non-boolean value ('true', '1'), whether it comes from the dmstr_flowable configuration or from an application override of the parameter dmstr_flowable.mcp.read / .write / .deploy. To differ per environment, set literal values per environment, e.g. in config/packages/prod/dmstr_flowable.yaml or under when@prod:.

API resources

All resources are served under /api/flowable/*:

Resource Notable operations
FlowDeployment GET /deployments, GET /deployments/{id}, POST /deployments/upload, DELETE
FlowProcessDefinition GET /process_definitions, POST /process_definitions/{id}/start, GET /process_definitions/{id}/input_schema
FlowProcessInstance GET /process_instances, POST /process_instances, DELETE
FlowTask GET /tasks, POST /tasks/{id}/complete, GET /tasks/{id}/input_schema
FlowExecution GET /executions, POST /executions/{id}/trigger
FlowHistoric* read-only history: activities, process instances, tasks, variables
FlowDmnDeployment GET /dmn_deployments, GET /dmn_deployments/{id}, POST /dmn_deployments/upload, DELETE
FlowDecision GET /decisions, GET /decisions/{id}, POST /decisions/execute
FlowHistoricDecisionExecution read-only DMN evaluation history (audit, failed flag)
FlowEventDeployment GET /event_deployments, GET /event_deployments/{id}, POST /event_deployments/upload, DELETE
FlowEventDefinition read-only GET /event_definitions, GET /event_definitions/{id}
FlowChannelDefinition read-only GET /channel_definitions, GET /channel_definitions/{id}
FlowEventInstance POST /event_instances — send an event into the engine
FlowExternalWorkerJob GET /external_worker_jobs, POST /external_worker_jobs/acquire, POST /external_worker_jobs/{id}/{complete,fail,bpmnError,unacquire}
FlowJob read-only engine jobs: GET /jobs?kind=async|timer|suspended|deadletter|history, GET /jobs/{id}/stacktrace

Ids. Every id that becomes a segment of an engine path must match ^[A-Za-z0-9][A-Za-z0-9:._-]*$; any other id is answered with 400 before a request reaches the engine. The rule sits in FlowableClient, so it applies to HTTP, MCP, the CLI, the external worker and direct use of the client alike. It covers the id formats Flowable generates (UUID, numeric, key:version:id) but is not verified against a live engine; a process definition whose BPMN key starts with _ or contains non-ASCII letters (id e.g. _key:1:5) cannot be addressed by id through the bundle. Deployment resource names (e.g. <formKey>.schema.json) only must not contain . or .. segments.

Uploads. The upload operations (/deployments/upload, /dmn_deployments/upload, /event_deployments/upload), the deploy tools and the upload commands (flowable:deployments:upload, flowable:dmn:deployments:upload, flowable:events:deployments:upload, which take the base name of --file) accept a plain file name only: at most 255 characters, no /, no \, no .., no leading ., no quotes and no control characters. Each accepts only the extensions its repository deploys, and a command the same ones as its HTTP upload, with the same messages: the process upload bpmn, xml, dmn, form, json, bar, zip, the DMN upload dmn, bar, zip, the event upload event, channel, flowable_dmn_deploy dmn only, flowable_deploy_bundle bpmn, xml, form, json. The check uses the full suffix, in any case: where DMN or CMMN is not accepted, .dmn.xml and .cmmn.xml are refused like .dmn and .cmmn, so the process upload, its command and flowable_deploy_bundle refuse .cmmn.xml, and flowable_deploy_bundle also .dmn.xml; the DMN and event uploads refuse .dmn.xml or .event.xml as .xml. A refused file name or extension is rejected before anything is sent (over HTTP with 400). The bundle sets no size limit for a multipart upload; it is bounded by the web server in front of the application (nginx client_max_body_size, default 1m) and PHP's upload_max_filesize / post_max_size, so raise those for larger BPMN or DMN files. The limits of inline files over MCP are under Tool arguments.

Custom actions in the Hydra documentation

The operations that are actions rather than CRUD carry the marker extraProperties: ['custom_action' => true]: POST /decisions/execute, POST /deployments/upload, POST /dmn_deployments/upload, POST /event_deployments/upload, POST /event_instances, POST /executions/{id}/trigger, POST /external_worker_jobs/acquire, POST /external_worker_jobs/{id}/{complete,fail,bpmnError,unacquire}, POST /process_definitions/{id}/start, POST /tasks/{id}/complete and GET /jobs/{id}/stacktrace, 14 operations in all. The marker changes nothing about how an operation behaves; it is read by dmstr/api-platform-utils-bundle, which lists each marked operation in the static Hydra documentation (/api/docs.jsonld) as a custom action: @type contains schema:Action, hydra:title is the operation name (e.g. flow_task_complete, flow_external_worker_job_bpmnError), and the URL is in @id for a path without placeholder (/api/flowable/decisions/execute) or in hydra:uriTemplate for a path with {id} (/api/flowable/tasks/{id}/complete). API Platform lists the POST actions under the entrypoint property of their resource and the stacktrace GET under its class. A client, such as an admin UI building an actions menu, can thus tell the actions from CRUD without hard-coding paths.

Not marked, on purpose: the two input_schema GETs (they read a schema for a form, they do not act), POST /process_instances (it creates a resource, so API Platform's own schema:CreateAction fits), every other CRUD operation including the DELETEs, and the MCP tools, which the marker does not concern. Utils 0.7 and older classified actions by path depth instead of the marker; compared with that, the input_schema GETs are no longer listed as actions and POST /event_instances is listed for the first time. tests/Metadata/CustomActionMarkerTest.php and tests/Http/CustomActionHydraDocumentationTest.php pin the set.

Errors and correlation id

The bundle maps the engine's answer to the status of its own response and passes on nothing of the engine's internals (host, URL, body, transport error):

  • an engine 404 is a 404 Flowable resource not found.;
  • an engine 400 is a 422 Flowable rejected the request: <message> with the first line of the engine's error message (message, else exception of its error JSON), at most 200 characters (... appended when cut), or Flowable rejected the request. when it has none; only an engine 400 becomes a 422;
  • every other engine status of 400 or above (401 and 403 included: the credentials are the bundle's, not the caller's) is a 502 Flowable backend error (correlation id: <id>).;
  • a timeout, a refused connection or a transport error while reading the body is a 504 Flowable engine unreachable (correlation id: <id>)..

A 502 or 504 carries only that generic message with a random id of 16 hex characters. Over HTTP the id is also sent as the X-Correlation-Id response header; over MCP the message is the JSON-RPC error message, on the CLI the printed error. The details are logged once, by FlowableClient, on the flowable channel as flowable.upstream_error (level error) with the context correlationId, status (502 or 504) and, for a 502, upstreamStatus, method, url, engineMessage and body (excerpts of at most 2000 characters), for a 504 method, url, exception (the class) and exceptionMessage. Search the log for the id a user reports. A 404 or 422 hides nothing and is not logged. FlowableClient::getHealthInfo() and flowable:health report a failed check as status: DOWN with the generic message as detail; reachable is false only for a 504.

PHP code that decides by the engine's own status (e.g. a fallback when the engine is down) reads it from FlowableApiException::getUpstreamStatus(). It is for PHP code only and appears in no message, response, MCP error message or CLI output. For every exception built from an engine response it returns the status the engine answered with, unmapped, also behind a 404 or 422 (e.g. 503 or 504 behind a 502, 400 behind a 422, 404 behind a 404); for a transport error (the 504) it is null, so an engine that itself answers 504 (status 502, upstream status 504) can be told from a timeout (status 504, null). What counts as an outage is the consumer's decision. Do not write the value into a response: that would undo what this section describes.

Audit

Every write the bundle sends to the engine is logged on the flowable channel (FlowableAuditLogger): flowable.<action>.attempt (level info) right before the engine call, then flowable.<action> (level info) on success or flowable.<action>.failure (level warning) when the call throws; the exception is rethrown unchanged. The success message is the one the single audit entry had before the attempt and failure entries existed, so a consumer that matches it still sees exactly the successful writes. The context keys come in this order:

  1. state: attempt, success or failure;
  2. via: http, mcp, cli or worker, the transport the write came in over;
  3. tool: the MCP tool name, only for via: mcp;
  4. actor: for http and mcp the identifier of the authenticated user; for cli the --acting-user value, but the worker id for the job commands flowable:external-worker:complete, :fail, :bpmn-error and :unacquire; for worker (ExternalWorkerRunner, the loop of flowable:external-worker:run) the worker id; null when unknown;
  5. the context of the action (ids, file names, hashes), on success followed by the keys taken from the result (e.g. deployment, instance);
  6. on failure only: status (the HTTP status of the exception, null for another exception), correlationId (only for a 502 or 504: the id of its flowable.upstream_error entry) and exception (the class).

Deployments record what was sent: file and sha256 for a single file (the three upload operations, flowable_dmn_deploy, the upload commands), and for flowable_deploy_bundle, which packs its files into one .bar, files, fileSha256 (file name → hash), archive and archiveSha256. A call the bundle rejects before the engine call (missing permission, invalid input or selector, a write command without its required --acting-user) writes no entry. Reads are not audited, and neither is the acquire call of ExternalWorkerRunner, as an idle worker polls every few seconds; POST /external_worker_jobs/acquire is a write over HTTP and is audited.

External worker tasks

An <serviceTask flowable:type="external-worker" flowable:topic="…"> inverts the direction of an integration: the engine calls nothing, it puts a job on a topic and waits. That removes both problems a flowable:type="http" task has — no inbound route from the engine to the application, and no credential in the deployment artifact (the .bar usually lives in git; here the worker authenticates).

Write a handler and you are done — the interface is autoconfigured, so no attribute and no service entry is needed:

final class InvoiceHandler implements ExternalWorkerHandlerInterface
{
    public function topics(): array { return ['invoice-export']; }

    public function handle(ExternalWorkerJob $job): ExternalWorkerOutcome
    {
        $id = $job->variables['invoiceId'] ?? null;

        return ExternalWorkerOutcome::complete(['exportedAt' => date(DATE_ATOM)]);
        // or: ExternalWorkerOutcome::bpmnError('INVOICE_REJECTED')  → modelled error path
        // or: ExternalWorkerOutcome::fail(retries: 2)               → engine retry/backoff
        // throwing is reported as fail() with the exception message
    }
}

Run the poll loop with flowable:external-worker:run (see CLI below). Two rules the runner enforces, both deliberate: a handler that throws becomes a fail (the engine owns backoff and dead-lettering — the worker adds no second retry policy), and a topic without a handler is unacquired, never failed, because failing would spend a retry over an incomplete deployment.

lockDuration and retryTimeout are ISO-8601 durations (PT10M), not numbers. Note that a job which exhausted its retries disappears from GET /external_worker_jobs and is then only visible as GET /jobs?kind=deadletter — which is why the read-only FlowJob resource ships with this feature rather than after it.

DMN (decision) engine

flowable-rest ships the DMN engine in the same container under the /dmn-api prefix (the process engine lives under /service); both are reached through the same flowable ApiConfiguration. The DMN engine keeps a separate repository, so a .dmn packaged inside a process (.bar) deployment is not registered as a decision — deploy decision tables via POST /dmn_deployments/upload. POST /decisions/execute evaluates a decision by key ({ "decisionKey": "…", "inputVariables": {…}, "singleResult": false }) and returns the matching rule outputs on the response's result: a list of rows, one per matched rule, each the list of result variables {"name", "type", "value"} as the engine returns it, not a map of output name to value. With "singleResult": true the engine's single result is the only row; no matching rule gives an empty list. Every evaluation adds a row to the engine's decision history (FlowHistoricDecisionExecution), so it is not a read.

Engine version: the DMN resources require a Flowable engine >= 8.0.0 (the DMN repository resource is named decisions; earlier engines exposed decision-tables).

Event registry

flowable-rest ships a third engine repository under the /event-registry-api prefix, again behind the same flowable ApiConfiguration. It stores event definitions (.event — the payload contract and correlation keys of a business event) and channel definitions (.channel — how events travel: type is inbound/outbound, implementation the transport).

The operation worth having is POST /event_instances: it hands an event straight to an inbound channel inside the engine, with no message broker in between.

{
  "eventDefinitionKey": "myEvent",
  "channelDefinitionKey": "myInboundChannel",
  "eventPayload": { "customerId": "42", "amount": 19.99 }
}

Inbound event correlation (BPMN event sub-processes, receive events, boundary events) is therefore usable and verifiable without running Kafka or RabbitMQ. The outbound direction (engine → broker) leaves the engine and is a separate, broker-dependent concern that this bundle does not cover.

Both an event definition reference (eventDefinitionKey or eventDefinitionId) and a channel definition reference (channelDefinitionKey or channelDefinitionId) are required — the channel is what turns the payload into a correlated event. The engine answers 204 No Content, so the operation returns no body. eventPayload must be a JSON object.

No .bar/.zip bundles here. Unlike the process and DMN repositories, POST /event_deployments/upload accepts only a single .event or .channel file (the engine's own API description claims otherwise, but it only ever tests those two suffixes). A deployment needing several resources is uploaded one file at a time.

The input_schema endpoints return the per-task / per-definition input JSON-Schema, resolved at runtime from either an authored <formKey>.schema.json deployment resource or by converting inline Flowable form-data — via the pluggable flowable.task_form_source chain. Start forms work exactly like task forms: put flowable:formKey="<key>" on the BPMN startEvent and ship <key>.schema.json in the same deployment (.bar/ .zip); the resolved fields are wrapped in the businessKey / variables / apiConfiguration envelope of the start operation.

A start-form schema may carry a top-level x-businessKey object to customise the envelope's businessKey property — e.g. a Jedison x-watch/x-template pair that composes the key live from the form variables:

{
  "type": "object",
  "x-businessKey": {
    "title": "Business Key",
    "x-watch": { "jahr": "#/variables/jahr", "revierId": "#/variables/revierId" },
    "x-template": "foo-{{ jahr.value }}-{{ revierId.value }}"
  },
  "properties": { "…": {} }
}

The object is merged over the default businessKey definition and stripped from the variables schema — the composition rule ships with the process deployment instead of being hard-coded in a UI. Details (semantics, watch paths, Jedison rendering, IRI caveat): docs/start-form-business-key.md.

A task-form field may name the process variable holding its data with x-process-data-var, so a step that produced data can hand it to the next step's form:

{
  "landkreise": {
    "type": "array",
    "x-process-data-var": "landkreise"
  }
}

The variable's value — arrays and objects included, not just scalars like {{ token }} — is moved into the field's default, which form renderers use as the initial value; the keyword itself is stripped. Because completion writes the field back to that same variable, reopening an unfinished task shows the last saved state. A missing variable leaves the field without a default and keeps the keyword visible for debugging. Details: docs/task-form-prefill.md.

MCP tools

The bundle declares 14 MCP tools as API Platform McpTool entries on its resources. API Platform serves them when its MCP support is installed and enabled; the packages are suggested, not required:

  • symfony/mcp-bundle serves the tools;
  • mcp/sdk is the MCP server runtime it runs on.

Nothing is exposed until the switches dmstr_flowable.mcp.read / mcp.write / mcp.deploy are turned on. A tool needs its switch and its permission: the switch decides whether the tool exists, the permission whether the caller may use it (see Security). The read tools have their own permission, flowable:mcp_read, separate from flowable:read of the HTTP read operations, because tool results go to a language model and the engine has no per-user access check on tasks, variables and history.

Warning: tool results contain engine data that users or external systems wrote (variables, task descriptions, exception messages). Treat it as untrusted input to the model, and do not give an agent that reads such data the write or deploy tools without a human confirming each call.

Tool Switch Permission Tag (_meta de.dmstr/tag) Backing operation
flowable_list_process_definitions read flowable:mcp_read Flowable GET /process_definitions (FlowProcessDefinitionProvider)
flowable_list_tasks read flowable:mcp_read Flowable GET /tasks (FlowTaskProvider)
flowable_get_task_form read flowable:mcp_read Flowable like GET /tasks/{id}/input_schema (FlowTaskFormProvider)
flowable_get_process_status read flowable:mcp_read Flowable composite: process instance, open tasks, executions (FlowProcessStatusProvider)
flowable_history_get read flowable:mcp_read Flowable/History composite: historic activities, historic variables, failed decision executions (FlowProcessHistoryProvider)
flowable_system_list_deadletter_jobs read flowable:mcp_read Flowable/System GET /jobs?kind=deadletter, kind fixed (FlowJobProvider)
flowable_start_process write flowable:process_start Flowable POST /process_instances, by key or id (ProcessInstanceCreateProcessor)
flowable_complete_task write flowable:task_complete Flowable POST /tasks/{id}/complete (TaskCompleteProcessor)
flowable_dmn_evaluate write flowable:decision_evaluate Flowable/DMN POST /decisions/execute (DecisionExecuteProcessor)
flowable_events_send write flowable:event_send Flowable/Events POST /event_instances (EventInstanceCreateProcessor)
flowable_system_trigger_execution write flowable:execution_trigger Flowable/System POST /executions/{id}/trigger (ExecutionTriggerProcessor)
flowable_dmn_deploy write + deploy flowable:deploy Flowable/DMN POST /dmn_deployments/upload with an inline file (DmnDeploymentUploadProcessor)
flowable_deploy_bundle write + deploy flowable:deploy Flowable several inline files as one .bar deployment (DeploymentBundleProcessor)
flowable_system_execute_timer_job write flowable:job_execute Flowable/System no HTTP operation; FlowableClientInterface::executeTimerJob() (TimerJobExecuteProcessor)

Every tool carries annotations (readOnlyHint, destructiveHint, idempotentHint), its security expression (is_granted() with the permission) and the de.dmstr/tag entry in _meta. Every tool that changes engine state in a way that cannot be undone (start, complete, trigger, send an event, deploy, execute a timer job) declares destructiveHint: true, so MCP clients ask before calling it; only flowable_dmn_evaluate, which adds no more than a history row, is a write tool with destructiveHint: false. Each description is one line that names the fields of the result, because some agent frameworks ignore structuredContent; the result is the serialised resource (or result object) in API Platform's MCP output format.

Results and errors. A successful call returns a result whose text content is the serialised resource and whose structuredContent is the same data before encoding; the tools that return null (complete, trigger, send an event, execute a timer job) declare structuredContent: false, publish no outputSchema and return the text null without structuredContent. A failing call is answered with a JSON-RPC error (code -32603), not with a tool result carrying isError: API Platform's MCP handler turns the HTTP exception of a failed call (403, 404, 422, the 502/504 of Errors and correlation id) into a JSON-RPC error with the exception's message, and the MCP SDK answers any other exception with its own generic message. structuredContent and the published outputSchema are both built for the tool's output format, the first format of the application's API Platform configuration (jsonld with the defaults), but they do not name the same keys: for a tool that returns one API resource (flowable_dmn_evaluate, flowable_start_process, the two deploy tools) the schema is the JSON-LD schema with @context, @id and @type; for the list tools the collection schema names totalItems, member, view and search, but not the @context, @id (null) and @type (Collection) that structuredContent carries at the top; for a tool that returns a plain result class (flowable_get_process_status, flowable_history_get, flowable_get_task_form) the schema names only the fields of the class, while structuredContent also carries @context, @id and @type. No published outputSchema sets additionalProperties: false, so the extra keys pass a validator that follows the schema, but a client that compares structuredContent strictly with outputSchema sees these differences.

Notes on individual tools:

  • flowable_start_process starts by processDefinitionKey (latest version) or processDefinitionId, so an agent needs no prior lookup of the definition id; it is backed by POST /process_instances, not by POST /process_definitions/{id}/start.
  • flowable_dmn_evaluate returns result as described under DMN (decision) engine: a list of rows, each the engine's list of result variables {name, type, value}, not a map. It changes no engine state except a history row, which every call adds, but it is gated behind its own permission, flowable:decision_evaluate, like its HTTP operation, so it is declared a write tool (readOnlyHint: false, idempotentHint: true) and appears only with mcp.write.
  • flowable_get_process_status answers only for running instances; flowable_history_get covers ended ones. Both are composites: when one of their engine calls fails, the tool fails as a whole and never returns a partial result. Each list holds at most 200 rows; the *Total fields tell whether it was cut. flowable_get_process_status has a total for the open tasks only (openTasksTotal): it reads at most 200 executions of the instance and has no total for them, so activeExecutions and currentActivityIds give no sign when an instance has more. Of the activities and failed decision executions of flowable_history_get the newest 200 are kept, oldest first.
  • flowable_system_execute_timer_job moves the timer job to the executable jobs (POST management/timer-jobs/{id} with {"action": "move"}); the bundle does not run the job itself. Precondition: the engine has an active async executor, which then runs the moved job; without one the call has no visible effect. The remaining wait cannot be restored, hence destructiveHint: true. The call is pinned against a simulated engine, not verified against a real one.
  • flowable_deploy_bundle refuses .dmn and .dmn.xml files (and .cmmn, .cmmn.xml), in any case: a process deployment does not register decision tables in the DMN engine, so they go to flowable_dmn_deploy. Building the archive needs the PHP zip extension.

Tool arguments

All arguments are top-level. Operations with a JSON body take the body properties plus the URI variable (id), which is not part of the body; apiConfiguration selects the engine connection (first 8 characters or full UUID, see Selecting a configuration). List tools take page, itemsPerPage (at most 200), sort, order and the filters their input schema names, e.g. processDefinition (id or IRI) and processInstanceId on flowable_list_tasks. Variables are passed preferably as a map {"name": value}; the explicit list [{"name", "value", "type"}] is accepted too.

The advertised input schema of a tool is the operation input file next to its resource class (e.g. src/ApiResource/FlowTask/complete.input.json; tool-only files are named mcp<Verb>.input.json), with the URI variables added as required properties. Top-level allOf/anyOf/oneOf alternatives ("one of these keys is required") are left out of the advertised schema because several MCP clients cannot represent them; the tool description names the rule, and the processor validates the full file.

The arguments are validated before the tool runs: the arguments of every tool are checked against exactly the advertised schema, URI variables included, in one central place (see below), and the write tools' processors then check the body against the full input file. A violation is answered with 422 Input validation failed: …: unknown keys (e.g. kind on flowable_system_list_deadletter_jobs, processInstance on flowable_list_tasks), strings for numbers ("page": "2") and values outside the bounds are rejected, not ignored. A tool whose input schema cannot be built (missing file, invalid JSON, .. in the path) is removed from the metadata, so it is neither listed nor callable, and logged as flowable.mcp.tool_hidden (level error) on the flowable channel when the API Platform metadata cache is built. The HTTP read operations and their query parameters are not affected.

Central validation. In front of every tool's provider, the bundle validates the arguments of each tool call of its own resources (classes under Dmstr\Flowable\ApiResource\) against the advertised schema, so a tool stays validated when your application replaces the bundle's provider with one of its own. The check is a decorator (State\McpToolInputValidationProvider) of the read step of API Platform's MCP provider chain: api_platform.mcp.state_provider.read with use_symfony_listeners: true, otherwise api_platform.state_provider.read. It runs after the pre_read security check and before the provider; a call without MCP arguments (every HTTP request) passes through unchanged. It is fail-closed: a bundle tool without a buildable input schema is rejected, and when API Platform's MCP support is on but neither chain exists, the container build fails with a LogicException; with MCP off nothing is registered. Write tools are checked here first and then against the full input file by their processor, so an invalid URI variable (e.g. a numeric id) is rejected before the processor runs. Tools of other bundles and of the application are not touched. Limitation: a tool whose security expression uses object is checked against the object only after reading, so its arguments are validated before that object-level check.

Files are passed inline instead of as a multipart upload:

{
    "name": "rates.dmn",
    "content": "<?xml version=\"1.0\"?><definitions …>…</definitions>",
    "deploymentName": "rates"
}

name is the file name including its extension (a plain file name, see Uploads), content the file content as text, or base64-encoded with "contentEncoding": "base64". flowable_dmn_deploy takes a single .dmn only; archives (.bar, .zip) are deployed through the HTTP upload POST /dmn_deployments/upload. flowable_deploy_bundle takes a list of such files plus deploymentName:

{
    "deploymentName": "order-process",
    "files": [
        {"name": "order.bpmn20.xml", "content": "<?xml …"},
        {"name": "approve.schema.json", "content": "{\"type\": \"object\", …}"}
    ]
}

Limits, fixed and not configurable: at most 1 MiB per file after decoding, and for flowable_deploy_bundle at most 20 files and 4 MiB in total after decoding; file names and deploymentName, deploymentSource, category, tenantId at most 255 characters each. Two limits in front of the bundle apply first. The web server's request size limit (nginx client_max_body_size, default 1m) already refuses a tool call carrying a 1 MiB file, so raise it on the MCP endpoint if agents deploy files of that size. The HTTP transport of mcp/sdk refuses request bodies above 4 MiB (4194304 bytes, StreamableHttpTransport::DEFAULT_MAX_BODY_BYTES); as the whole JSON-RPC request counts and base64 is a third larger than the decoded bytes, a bundle near the 4 MiB total is refused by the transport before the bundle's own check.

Rate limiting

The bundle ships no rate limiter: how many tool calls a user or an agent may make is a decision of the application, and the MCP endpoint belongs to symfony/mcp-bundle, not to the bundle. To put one in front of it, install symfony/rate-limiter, define a limiter and consume it in a small kernel.request listener for the MCP path (http.path of the symfony/mcp-bundle server, /mcp/<server name> by default). The firewall's login_throttling is not the tool for this: it limits login attempts, not requests. The listener runs after the firewall (priority 8), so it can key the limiter by the authenticated user, with the client IP as fallback. Every JSON-RPC request counts, initialize and tools/list included. An example for Symfony 7.4, written against the documented API and not run in this bundle's suite:

# config/packages/rate_limiter.yaml
framework:
    rate_limiter:
        mcp:
            policy: sliding_window
            limit: 60
            interval: '1 minute'
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\RateLimiter\RateLimiterFactoryInterface;

#[AsEventListener(event: KernelEvents::REQUEST, priority: 7)]
final class McpRateLimitListener
{
    public function __construct(
        private readonly RateLimiterFactoryInterface $mcpLimiter, // the "mcp" limiter above
        private readonly Security $security,
    ) {
    }

    public function __invoke(RequestEvent $event): void
    {
        $request = $event->getRequest();
        if (!$event->isMainRequest() || $request->getPathInfo() !== '/mcp') { // your MCP path
            return;
        }

        $key = $this->security->getUser()?->getUserIdentifier() ?? $request->getClientIp() ?? 'unknown';
        $limit = $this->mcpLimiter->create($key)->consume();
        if (!$limit->isAccepted()) {
            $event->setResponse(new JsonResponse(
                ['error' => 'Too many MCP requests.'],
                429,
                ['Retry-After' => (string) max(1, $limit->getRetryAfter()->getTimestamp() - time())],
            ));
        }
    }
}

The limit applies per HTTP request; a client gets a 429 with Retry-After instead of a JSON-RPC answer. The same listener can cover the HTTP operations under /api/flowable/* by matching that prefix.

CLI

Every REST operation has a matching command; command IDs mirror the resource URLs:

flowable:health
flowable:deployments                 flowable:deployments:upload
flowable:process-definitions
flowable:process-instances           flowable:process-instances:create
flowable:tasks                       flowable:tasks:complete
flowable:executions                  flowable:executions:trigger
flowable:dmn:deployments             flowable:dmn:deployments:upload
flowable:dmn:decisions               flowable:dmn:rule:execute
flowable:events:deployments          flowable:events:deployments:upload
flowable:events:definitions          flowable:events:channels
flowable:events:instances:create
flowable:external-worker-jobs        flowable:external-worker:run
flowable:external-worker:complete    flowable:external-worker:fail
flowable:external-worker:bpmn-error  flowable:external-worker:unacquire
flowable:jobs

--api-configuration (-c) takes the first 8 characters or the full UUID, lowercase, of an active flowable configuration, as described under Selecting a configuration; without it, the only active one is used. Ids passed to the commands follow the id rule.

flowable:external-worker:run is the poll loop: --topic (repeatable, empty = every registered handler's topics), --worker-id, --lock-duration=PT10M, --batch, --max-jobs, --time-limit, --once.

Graceful shutdown requires ext-pcntl. With pcntl loaded, SIGTERM / SIGINT finish the current job, unacquire whatever is still locked and exit, so a container restart leaves no jobs locked. With --batch greater than 1, the rest of the acquired batch is unacquired on a stop instead of being processed. Without pcntl the command still runs (getSubscribedSignals() returns an empty list, so Symfony does not refuse to start it) — but nothing handles the signal: on SIGTERM the acquired jobs stay locked until their lockDuration expires, and the engine hands them out again only after that. Install pcntl before running this as a long-lived worker process, and keep --lock-duration short enough that a lost lock is not painful. Verified 2026-07-29 on a php:8.4 image without pcntl.

Security

The bundle checks no role names. Every HTTP operation and every one of the 14 MCP tools checks its own permission attribute with is_granted('<permission>') and subject null. The bundle grants none of the permissions itself: a permission voter in the application maps its roles or users to them. Without such a voter every operation and every tool answers 403 (fail closed), so provide the mapping before you install or upgrade.

Permission Guards
flowable:read all read operations of the engine resources, the two input-schema operations (/process_definitions/{id}/input_schema, /tasks/{id}/input_schema) and GET /jobs with any kind (the dead-letter list is GET /jobs?kind=deadletter)
flowable:read_stacktrace GET /jobs/{id}/stacktrace
flowable:mcp_read the 6 read MCP tools, including flowable_system_list_deadletter_jobs
flowable:deploy the three upload operations (/deployments/upload, /dmn_deployments/upload, /event_deployments/upload) and the tools flowable_deploy_bundle and flowable_dmn_deploy
flowable:deploy_delete the three deployment delete operations (DELETE /deployments/{id}, /dmn_deployments/{id}, /event_deployments/{id})
flowable:decision_evaluate POST /decisions/execute and flowable_dmn_evaluate
flowable:process_start POST /process_definitions/{id}/start, POST /process_instances and flowable_start_process
flowable:process_delete DELETE /process_instances/{id}
flowable:task_complete POST /tasks/{id}/complete and flowable_complete_task
flowable:event_send POST /event_instances and flowable_events_send
flowable:execution_trigger POST /executions/{id}/trigger and flowable_system_trigger_execution
flowable:worker the five External Worker operations (acquire, complete, fail, bpmnError, unacquire under /external_worker_jobs)
flowable:job_execute flowable_system_execute_timer_job

The constants are in Dmstr\Flowable\Security\FlowablePermissions (all() returns the 13 values). The bundle registers them as 13 za7_core.permission service tags (tag attribute permission), so applications that collect such tags, such as hrzg/za7-core, can offer them for assignment; the bundle itself depends on nothing for this and has no permission map or config node of its own.

The MCP switches dmstr_flowable.mcp.read / mcp.write / mcp.deploy are independent of the permissions: a tool needs its switch and its permission.

The acting user is taken from the authenticated identity (JWT sub) and propagated to Flowable, see docs/tenant-and-user.md.

Migrating from 0.10

0.10 checked fixed roles: the read operations required the application's base user role, all write operations and all 14 MCP tools required its administrator role. The job stacktrace and the two input-schema operations declared a role but did not enforce it, so any request that passed the firewall got them. 0.11 checks the permissions above, so an application without a voter for them loses all access after the upgrade. The old behaviour is reproduced by mapping the former user role to flowable:read and the former administrator role to all 13 permissions. The map has no hierarchy, so the administrator needs flowable:read explicitly. A minimal voter, with <your-admin-role> and <your-user-role> replaced by the roles your application uses:

use Dmstr\Flowable\Security\FlowablePermissions;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;

final class FlowablePermissionVoter extends Voter
{
    protected function supports(string $attribute, mixed $subject): bool
    {
        return in_array($attribute, FlowablePermissions::all(), true);
    }

    protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
    {
        $roles = $token->getRoleNames();

        if (in_array('<your-admin-role>', $roles, true)) {
            return true;
        }

        return $attribute === 'flowable:read' && in_array('<your-user-role>', $roles, true);
    }
}

With autoconfiguration the voter is registered by itself. If the application already has a permission voter driven by a role-to-permission map, add the permissions to the entries of your roles instead. Also note the other breaking changes of 0.11: PHP >= 8.5 and dmstr/api-configuration-bundle ^0.6, see the changelog.

Documentation

Tests

The suite (tests/, configuration phpunit.dist.xml) needs no Flowable engine and no database server. The unit tests use a FlowableClientInterface double; besides them it has kernel-based suites under tests/Kernel and tests/Http that boot a test kernel and send HTTP and MCP requests; they authenticate with a test-only firewall that reads the roles from the X-Test-Roles header (it exists only under tests/). The test kernel stores the ApiConfiguration records in SQLite in memory (ext-pdo_sqlite, empty for every booted kernel) and answers the engine requests of the real FlowableClient with a MockHttpClient. CI runs the suite on PHP 8.5 (.github/workflows/tests.yml).

docker compose run --rm php composer install
docker compose run --rm php vendor/bin/phpunit

Without Docker, composer install && vendor/bin/phpunit works on any PHP 8.5 setup with the extensions pdo_sqlite and zip.

License

MIT © diemeisterei GmbH

About

Flowable BPMN engine pass-through resources, HTTP client and CLI for API Platform / Symfony.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages