Download the PHP package deverity/spawn-queue without Composer

On this page you can find all versions of the php package deverity/spawn-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package spawn-queue

SpawnQueue — CakePHP Queue Plugin

A robust queue engine for CakePHP 4 that runs each job in its own isolated process, eliminating the most common failure modes of long-lived single-process workers.

Why SpawnQueue?

Problem Solution
One bad job crashes the whole worker Each job is a separate process — failure is contained
Deploy requires manual worker restart Graceful shutdown: coordinator drains current jobs, then exits cleanly
Long-running jobs lock up other work Multiple queues with independent concurrency
Worker running stale code after deploy Short-lived child processes always load the latest code
No control over retry timing Exponential backoff + configurable max attempts per queue

Requirements

Installation

Via Composer

Load the plugin in src/Application.php:

Local / in-monorepo development

Add the namespace to your app's composer.json autoload:

Run the migration

SpawnQueue auto-detects whether dereuromark/cakephp-queue is already installed:


Configuration

Override defaults in config/app_local.php or any file loaded in your bootstrap:


Creating Handlers

Implement JobHandlerInterface for new-style handlers:

Dependency note: Handlers are instantiated with new ClassName(). Use LocatorAwareTrait, ConnectionManager, or other CakePHP service locators for dependencies — constructor injection is not supported in this version.

Exception / return reference

Thrown / returned Behaviour
RetryableJobException($msg) Re-queues with automatic exponential backoff
RetryableJobException($msg, retryAfterSeconds: 300) Re-queues with explicit delay
NonRetryableJobException($msg) Marks as failed immediately, no retry
Any other \Throwable Treated as retryable (safe default)
JobResult::success() Marks as done
JobResult::retry($error) Same as RetryableJobException
JobResult::fail($error) Same as NonRetryableJobException

Legacy dereuromark/cakephp-queue Tasks

Existing tasks that extend Queue\Queue\Task work without any modification. SpawnQueue wraps them automatically via LegacyTaskAdapter:


Enqueuing Jobs


Running the Coordinator

Run one coordinator per queue when you want separate OS processes, independent restart control, or stronger isolation between high-traffic queues:

For smaller deployments, queue:work-all starts one long-running process that manages every configured queue:

queue:work-all reads queue names from Configure::read('SpawnQueue.queues'). Both config shapes are supported:

If no queues are configured, queue:work-all falls back to default. Internally it still creates one QueueCoordinator per queue, each with its own worker pool and timeout settings, but all coordinators share a single parent process and one combined TUI dashboard.

Use queue:work-all when operational simplicity matters more than per-queue process isolation. Use separate queue:work <queue> processes when one queue has heavy traffic, long-running jobs, or different restart/deploy needs.

Commands Reference

Command Description
queue:work <queue> Start coordinator (--max-workers=N, --timeout=N, --show=lines\|tui)
queue:work-all Start one SuperCoordinator for all configured queues (--show=lines\|tui)
queue:run-job --job-id=N Run one job (internal — called by coordinator)
queue:stats [--queue=name] Job counts by queue and status
queue:requeue-stuck Recover jobs stuck in processing (--queue, --timeout)
queue:retry-failed Re-queue failed/dead jobs (--queue, --status, --limit)
queue:cleanup Delete old terminal jobs (--days=30, --status)

Terminal Output Modes

Controlled by SpawnQueue.show_type config or the --show CLI option:

Mode Output
lines (default) Scrolling log lines only — safe for log files and Supervisor
tui Live htop-like dashboard only — useful for interactive monitoring

Note: In tui mode the log lines from child processes are suppressed. The dashboard refreshes in-place — do not redirect stdout to a file in this mode.


Job States


Production Setup

Supervisor (recommended)

Single process for all queues:

Separate process per queue:

systemd

Single process for all queues:

Separate process per queue:

Deploy without downtime


Architecture

Claim Strategy

SpawnQueue tries SELECT … FOR UPDATE SKIP LOCKED first. On older databases (MySQL < 8.0, MariaDB < 10.6) it falls back to a conditional UPDATE — safe but may cause minor contention on very busy queues.


Migrating from dereuromark/cakephp-queue

  1. Install SpawnQueue and run the migration (adds columns, keeps all existing jobs)
  2. Keep dereuromark installed — your app still uses it to write jobs
  3. Stop the old bin/cake queue:worker processes
  4. Start SpawnQueue coordinators
  5. Gradually migrate task classes to implement JobHandlerInterface
  6. Once all tasks are migrated, remove the dereuromark dependency

SpawnQueue picks up both old-style (no queue column) and new-style jobs. Old jobs are routed to the default coordinator.


Backoff Schedule

Attempt Delay before next try
1 10 seconds
2 30 seconds
3 2 minutes
4 10 minutes
5+ 30 minutes

Override for a specific failure: throw new RetryableJobException($msg, retryAfterSeconds: 3600);


License

MIT


All versions of spawn-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cakephp/cakephp Version ^4.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package deverity/spawn-queue contains the following files

Loading the files please wait ...