Search by

adachsoft / workflow-launcher-symfony-bundle

Arkadiusz Adach

Symfony bundle for configuring and launching workflows with adachsoft/workflow-launcher.

Package info

gitlab.com/a.adach/workflow-launcher-symfony-bundle

Issues

Type:symfony-bundle

pkg:composer/adachsoft/workflow-launcher-symfony-bundle

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

v0.3.0 2026-11-21 10:20 UTC

This package is auto-updated.

Last update: 2026-11-21 09:21:06 UTC


README

This bundle integrates adachsoft/workflow-launcher with Symfony applications. It configures file-backed launch envelopes and idempotency, lease-backed concurrency slots, and the workflow:launch and workflow:dispatch-resume console commands.

Installation

Install the package with Composer and register AdachSoft\WorkflowLauncherSymfonyBundle\WorkflowLauncherBundle in your Symfony application. The application must provide Psr\Clock\ClockInterface, WorkflowDefinitionRepositoryInterface, and WorkflowRunnerInterface services.

Configuration

# config/packages/workflow_launcher.yaml
workflow_launcher:
    storage_dir: '%kernel.project_dir%/var/workflow-launcher'
    console_path: '%kernel.project_dir%/bin/console'
    slot_ttl_seconds: 21600
    idempotency_ttl_seconds: 86400
    workflows:
        article_publishing:
            max_parallel: 1
            on_conflict: reject
        article_correction:
            max_parallel: 2
            concurrency_key: 'input.slug'

storage_dir is required. The bundle creates envelopes/, idempotency/, locks/, and logs/ beneath it. The PHP executable defaults to PHP_BINARY, the console path to %kernel.project_dir%/bin/console, and the slot and idempotency TTLs to 21600 and 86400 seconds. Each workflow policy requires max_parallel (at least one), accepts an optional input path such as input.slug, and defaults on_conflict to reject.

To replace the default launch budget guard, define a service for LaunchBudgetGuardInterface or use the workflow_launcher.launch_budget_guard service alias.

Launch a workflow

php bin/console workflow:launch article_correction \
    --input-json='{"slug":"stegosaurus"}' \
    --requested-by=operator \
    --format=json

Use --input-file instead of --input-json for larger or sensitive payloads. The two options cannot be used together.

The launch command validates the request and stores input in a private launch envelope. It starts a detached child process whose arguments contain only the generated run ID. The internal workflow:execute-launch command consumes and deletes the envelope, executes the workflow non-interactively, and releases its concurrency reservation after execution, including suspended runs.

Resuming in the background

Dispatch a decision or a due suspension timeout without keeping the calling process open:

php bin/console workflow:dispatch-resume run-123 \
    --decision=approve \
    --actor=operator \
    --payload='{"note":"reviewed"}' \
    --requested-by=operator \
    --format=json

php bin/console workflow:dispatch-resume run-123 --timeout --requested-by=scheduler

Specify exactly one of --decision and --timeout. The optional decision payload must be a JSON object. Timeout requests are accepted only after the suspension deadline has arrived. The command reports the dispatch status, run ID, and any rejection reason; it exits with code 0 when started, 2 when rejected, and 1 on errors.

Applications can inject AdachSoft\WorkflowLauncherContracts\WorkflowResumeDispatcherInterface and call dispatch() with AdachSoft\WorkflowLauncherContracts\Dto\WorkflowResumeRequestDto::decision(...) or AdachSoft\WorkflowLauncherContracts\Dto\WorkflowResumeRequestDto::timeout(...). The method returns a WorkflowLaunchResultDto; a STARTED result means the resume was scheduled in a detached process, while a REJECTED result includes the reason.

Security

Workflow input may contain credentials or other secrets. It is persisted only in launch envelope files protected with mode 0600 inside the private envelope directory; it is never placed in detached process arguments. Keep the configured storage directory on a trusted filesystem with access restricted to the application user.