xaav/queue-bundle
A Symfony bundle for adding queue-based background processing to PHP applications, with support for dispatching jobs and running workers so time-consuming tasks can be handled asynchronously outside normal web requests.
Install via Composer and register the bundle in app/AppKernel.php:
composer require xaav/queue-bundle
$bundles = array(
// ...
new Xaav\QueueBundle\XaavQueueBundle(),
);
Look first at the bundle's Resources/config/services.xml (or .yml) — that's where the queue service and the worker command are wired. Next, open the worker console command class; it tells you how jobs are pulled, processed, and how the loop terminates. Finally, check the bundle's DependencyInjection/Configuration.php for whatever options (backends, sleep intervals, etc.) it exposes.
The canonical first use case is: define a job object as a Symfony service (or plain PHP class holding its data), push it onto the queue from a controller, and drain the queue with the bundle's worker command run from cron or a supervisor process:
app/console xaav:queue:worker # exact name — check the Command class
Do a smoke test with a trivial "write a log line" job before wiring anything real. Since the bundle is old and thinly used, treat the source as the documentation.
Job definition + worker dispatch. The bundle's model is a job class plus a worker that calls a known method (commonly run()/execute()) on it. Keep jobs small, idempotent, and free of request-scoped state. If the worker unserializes jobs, everything a job needs must be in its properties — injected services, not entities.
DI integration. Register job classes as services and let the dispatcher fetch them by id, or construct them inline and pass serializable payloads. If the bundle supports named queues, map one queue per concern (mail, image processing, exports) so a slow job type doesn't starve the fast one.
Daemon vs. cron. Two patterns work: (a) long-running worker via supervisor, or (b) short-lived workers fired from cron every minute. For anything touching Doctrine, prefer short-lived workers (see Gotchas). Either way, always run workers under a process manager — the bundle won't restart itself.
Service/controller integration. Wrap dispatch in your own thin service (JobDispatcher) rather than calling the queue service directly from controllers. That gives you one place to add logging, queue selection, and a dispatchAfterResponse-style optimization later.
If you're coming from Laravel: this is not Laravel's queue. There's no jobs table migration, no failed_jobs, no Horizon, no retry/backoff DSL, no ShouldQueue marker. Expect to hand-roll retries, failure recording, and monitoring. Budget for that up front.
symfony/framework-bundle constraint in composer.json before committing.$em->clear() per job, or run short-lived workers. Same applies to any long-lived service you inject.run() in try/catch and log the exception plus payload before deciding whether to drop or requeue.illuminate/queue with the database or Redis driver, or Symfony's own Messenger with Doctrine/Redis transports. Use it only if you're maintaining a legacy Symfony2 app that already depends on it — otherwise pick a maintained queue and save yourself the retry/monitoring work.How can I help you explore Laravel packages today?