-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
No — it is for apps that don't have one. Laravel and Symfony already own a worker loop and retry machinery; the BabelQueue adapters plug into those. InitPHP Queue is the equivalent runtime for a plain PHP / Slim / Mezzio app that has no such loop of its own.
The SDK defines the wire format (the canonical envelope, URN routing,
validation, dead-letter annotation) and a publish-only Transport. It deliberately
does not own a consumer loop. InitPHP Queue is that consumer loop for
framework-less PHP, plus a database transport the SDK does not ship. It depends on
the SDK and reuses its codec, so the two never drift. See Core Concepts.
So the queue is polyglot and refactor-safe. A URN is a stable string any language can match on; a PHP class name is neither. See The Message Envelope.
No. The Producer is a one-line convenience over EnvelopeCodec + a transport;
HandlerMap is one implementation of HandlerResolver. You can publish raw
envelopes yourself and back routing with your own container — see
Producing Messages and
Handlers & Routing.
If you already have a database and want zero new infrastructure, use PDO. For throughput, use Redis. For a real broker with routing, use RabbitMQ. The overview has a comparison table.
The worker re-queues a failed message with a back-off delay from
WorkerOptions::$backoff. PDO and Redis honour the delay natively; RabbitMQ
applies retries immediately unless the delayed-message-exchange plugin is
installed. See Retries & Dead-Letters.
No — it is at-least-once. A message can be delivered more than once (e.g. a worker crashes after handling but before acking). Make handlers idempotent.
Yes — that is the whole point. They share the canonical envelope and route on the same URN. See Interoperability.
Run vendor/bin/queue work --bootstrap=worker.php --queue=... under a process
supervisor (systemd, supervisord, a container restart policy), and set a
maxJobs/memoryLimitMb limit so each worker exits and restarts with clean
memory. See The Worker.
Send SIGTERM (or SIGINT). With ext-pcntl installed, the worker finishes the
in-flight message and then exits.
No — predis/predis is a pure-PHP client. ext-redis (phpredis) is optional; see
Transport: Redis.
To a per-transport dead-letter destination (a *_failed table, a :failed list,
or a .failed queue). Decode the stored envelope, drop the dead_letter block,
reset attempts, and re-publish. See
Retries & Dead-Letters.
PHP 8.2, 8.3 and 8.4 are tested in CI.
InitPHP Queue · GitHub · Packagist · BabelQueue standard · MIT License
Getting Started
Messages
Consuming
Transports
Guides
Other