Search by

adachsoft / workflow-scheduler-bridge

Arkadiusz Adach

Schedule workflow launches using daily quotas and resume suspended runs after their deadlines.

Package info

gitlab.com/a.adach/workflow-scheduler-bridge

Issues

pkg:composer/adachsoft/workflow-scheduler-bridge

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-21 13:01 UTC

This package is auto-updated.

Last update: 2026-11-21 12:01:22 UTC


README

adachsoft/workflow-scheduler-bridge connects scheduled jobs to workflow launch and resume contracts. It launches configured workflows across quota-driven daily slots and resumes suspended runs after their deadlines.

Features

  • Launch scheduled workflows at evenly spaced slots within each schedule's local day, including daylight-saving transitions.
  • Obtain each schedule's daily quota at runtime, with a fixed-map provider included for simple setups.
  • Retry due launch slots on later ticks using stable idempotency keys; missed slots from previous days are not replayed.
  • Dispatch timeout resumptions for suspended workflow runs in paginated batches.
  • Keep schedule input unchanged; secret resolution remains the responsibility of the consuming application or workflow runtime.

The scheduled jobs are registered using the scheduler bundle's #[AsScheduledJob] attribute. The launch tick runs every fifteen minutes, and the suspended-run expiry job runs every five minutes. These are technical polling intervals; the application controls launch volume through LaunchQuotaProviderInterface.

Installation

Install the package with Composer:

composer require adachsoft/workflow-scheduler-bridge

Requirements

The package requires PHP 8.3 or later and integrates with adachsoft/scheduler-symfony-bundle, adachsoft/workflow, and adachsoft/workflow-launcher-contracts.

Usage

Provide services implementing LaunchScheduleProviderInterface and LaunchQuotaProviderInterface in your application's service container. ArrayLaunchScheduleProvider accepts schedule definitions with required id and workflowId keys, and optional input and timezone keys. FixedLaunchQuotaProvider accepts a schedule-ID-to-quota map; use your own provider to obtain quotas from application settings or another runtime source.

use AdachSoft\WorkflowSchedulerBridge\Quota\FixedLaunchQuotaProvider;
use AdachSoft\WorkflowSchedulerBridge\Schedule\ArrayLaunchScheduleProvider;

$schedules = new ArrayLaunchScheduleProvider([
    [
        'id' => 'daily_report',
        'workflowId' => 'daily_report',
        'input' => ['region' => 'eu'],
        'timezone' => 'Europe/Warsaw',
    ],
]);

$quotas = new FixedLaunchQuotaProvider([
    'daily_report' => 4,
]);

See the schedule configuration example for a fuller integration outline.

Unknown schedule keys, invalid time zones, duplicate IDs, and invalid values throw InvalidArgumentException. An omitted input defaults to an empty array and an omitted timezone defaults to UTC.

A quota of zero disables launches for that schedule for the day. Each due slot uses the idempotency key {scheduleId}:{localDate Y-m-d}:{slotIndex}. STARTED counts as launched, DUPLICATE as already done, and REJECTED as skipped; rejected slots remain due and are submitted again on later ticks. The launcher must retain idempotency keys for more than one day; configure idempotency_ttl_seconds to at least 86,401 seconds (for example, 172,800 seconds).

The shared launcher contract does not specify whether a REJECTED result claims its idempotency key. If your application relies on retries, ensure rejected launches do not claim the key.