All notable changes to initphp/queue are documented here. The format is based
on Keep a Changelog and this project
adheres to Semantic Versioning.
2.0 is a full rewrite. InitPHP Queue is now the framework-less BabelQueue
runtime for plain PHP: it owns the consumer/worker loop, retries and
dead-letter routing that babelqueue/php-sdk
deliberately leaves to the framework, while reusing the SDK's canonical
{ job, trace_id, data, meta, attempts } envelope so messages interoperate with
Go, Python, Node and any other BabelQueue SDK.
- Requires PHP
^8.2(was>=7.4) and depends onbabelqueue/php-sdk ^1.0. - Messages are routed by URN (
urn:babel:<context>:<event>) to mapped handlers, instead of serialising the producing PHP class name into the payload. This removes the PHP-onlynew $classFromPayload()coupling. - The abstract
Jobbase class,JobInterface,AdapterInterface,PDOAdapterandRabbitMQAdapterare removed. See UPGRADE-2.0.md.
Bugs from 1.x that no longer exist in the new design:
- The PDO worker never instantiated jobs (
$jobClass($this)called a function instead ofnew $jobClass(...)), so the database adapter never ran any job. RabbitMQAdapter::close()dereferenced a wrong (_failed) array key and threw.Job::push()reported success even when the adapter'spush()returned false.- The PDO consumer used a non-atomic
SELECT … status = 0thenUPDATE, letting two workers claim the same job, and busy-looped with no back-off. nack()moved rows to the failed table via a column-position-dependentINSERT … SELECT *.
Workerconsumer loop with max-attempts, exponential back-off, max-jobs / max-runtime / memory limits and gracefulSIGINT/SIGTERMshutdown.- URN → handler routing (
HandlerMap,Dispatcher) with the four canonical unknown-URN strategies (fail/delete/release/dead_letter). - Consume-side transports for PDO (database), Redis (
BLMOVE/LREM) and RabbitMQ (AMQP), each paired with the SDK's publish side. - A thin
Producerfacade overEnvelopeCodec+ aTransport. - A
bin/queueCLI worker entry point. - Opt-in idempotent consumption. A new
IdempotencyStorecontract (Contracts/IdempotencyStore.php) with an in-memory reference implementation (InMemoryIdempotencyStore) lets theDispatcherdedupe at-least-once redeliveries, processing a message at most once. Enable it by passing anIdempotencyOptionsto theDispatcher; the dedup key derives from a custom resolver, the envelope'smeta.id, or itstrace_id, and is recorded only after a handler succeeds (a throwing handler stays retryable). Disabled by default — existing behaviour is unchanged. Bring a durable, atomic store (Redis/PDO) for fleet-wide deduplication; see the README.