PHPackages                             heristop/jobqueue-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. heristop/jobqueue-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

heristop/jobqueue-bundle
========================

This bundle provides the use of Zend\_Queue from Zend Framework. It allows your Symfony application to schedule multiple console commands as server-side jobs.

v1.0.1(9y ago)169036MITPHPPHP &gt;=5.4.0

Since Feb 24Pushed 9y ago4 watchersCompare

[ Source](https://github.com/heristop/HeriJobQueueBundle)[ Packagist](https://packagist.org/packages/heristop/jobqueue-bundle)[ RSS](/packages/heristop-jobqueue-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

JobQueueBundle
==============

[](#jobqueuebundle)

[![SensioLabsInsight](https://camo.githubusercontent.com/0cdcd496d51129f48d1a142e6e72698d39fa8660258a89a33fb5b7f049d22018/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61366638363434322d356539632d346164662d626232332d6437333463363337623863642f6d696e692e706e67)](https://insight.sensiolabs.com/projects/a6f86442-5e9c-4adf-bb23-d734c637b8cd) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/0b8617bccd9d446b5ab35a776b1b167183c1d18b52778a3405724a1e6c94450c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6865726973746f702f486572694a6f62517565756542756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/heristop/HeriJobQueueBundle/?branch=master) [![Build Status](https://camo.githubusercontent.com/72067d024eb77d07d069ac4db52d516dc8c94f7264a6ea0fe7930745040afea5/68747470733a2f2f7472617669732d63692e6f72672f6865726973746f702f486572694a6f62517565756542756e646c652e737667)](https://travis-ci.org/heristop/HeriJobQueueBundle)

This bundle provides the use of `Zend Queue` from Zend Framework. It allows your Symfony 2/3 application to schedule multiple console commands as server-side jobs.

See the [Programmer's Reference Guide](http://framework.zend.com/manual/1.9/en/zend.queue.html) for more information.

Features:

- Manage multiple queues
- Schedule your Symfony commands
- Monitor messages and log exceptions
- Retry logic
- Prioritizing jobs
- RabbitMQ or database support
- Easy-to-use :)

Installation
------------

[](#installation)

Require `heristop/jobqueue-bundle` to your `composer.json` file:

```
{
    "require": {
        "heristop/jobqueue-bundle": "1.0.1",
        "zendframework/zend-queue": "2.*@dev"
    }
}
```

Load the bundle in AppKernel:

```
    $bundles[] = new Heri\Bundle\JobQueueBundle\HeriJobQueueBundle();
```

If you use the Doctrine adapter, update your database:

```
    app/console doctrine:schema:update --force
```

If you use the Amqp adapter, you may configure the connection in this way:

```
    # app/config/config.yml
    heri_job_queue:
        amqp_connection:
            host: localhost
            port: 5672
            user: guest
            password: guest
```

Usage
-----

[](#usage)

First, define a message which contains the Symfony command to call. For instance, we choose to add the clear command in a queue named "queue1":

```
    $queue = $this->get('jobqueue');
    $queue->attach('queue1');

    $queue->push([
        'command' => 'cache:clear'
    ]);
```

You can also call commands with arguments:

```
    $queue->push([
        'command'   => 'demo:great',
        'argument'  => [
            'name'   => 'Alexandre',
            '--yell' => true
        ]
    ]);
```

Then, add the queue to listen in the configuration:

```
    # app/config/config.yml
    heri_job_queue:
        enabled:            true
        max_messages:       1
        # set a process_timeout (in seconds) if you want your commands to be killed
        # when their execution time is too long (default: null)
        process_timeout:    60
        queues:             [ queue1 ]
```

Note: The queue is automatically created, but you can also use the command-line interface in this way:

```
    app/console jobqueue:create queue1
```

Listener Commands
-----------------

[](#listener-commands)

### Run the Listener

[](#run-the-listener)

To run new messages pushed into the queue, execute this command:

```
    app/console jobqueue:listen
```

### Specify a specific Queue

[](#specify-a-specific-queue)

You may specify which queue connection the listener should utilize (skipping configuration):

```
    app/console jobqueue:listen queue1
```

### Specify the Sleep Duration

[](#specify-the-sleep-duration)

You may also specify the number of seconds to wait before polling for new jobs:

```
    app/console jobqueue:listen --sleep=5
```

### Process the first Job on the Queue

[](#process-the-first-job-on-the-queue)

To process only the first job on the queue, you may use the `jobqueue:work` command:

```
    app/console jobqueue:work
```

### Show Jobs

[](#show-jobs)

To see the pending jobs, run the command below:

```
    app/console jobqueue:show [queue-name]
```

Failed Jobs
-----------

[](#failed-jobs)

If a job failed, the exception is logged in the database, and the command is call again after the setted timeout (default 90 seconds):

[![ScreenShot](https://camo.githubusercontent.com/c8a5adf16404a657c66a7f73cb83f31cc7bd4ef5c3eeb86de1aeec023ad230ab/68747470733a2f2f7261772e6769746875622e636f6d2f6865726973746f702f486572694a6f62517565756542756e646c652f6d61737465722f5265736f75726365732f646f632f636f6e736f6c652e706e67)](https://camo.githubusercontent.com/c8a5adf16404a657c66a7f73cb83f31cc7bd4ef5c3eeb86de1aeec023ad230ab/68747470733a2f2f7261772e6769746875622e636f6d2f6865726973746f702f486572694a6f62517565756542756e646c652f6d61737465722f5265736f75726365732f646f632f636f6e736f6c652e706e67)

To delete all of your failed jobs, you may use the `jobqueue:flush` command:

```
    app/console jobqueue:flush [queue-name]
```

Jobs Priority
-------------

[](#jobs-priority)

Jobs are executed in the order in which they are scheduled (assuming they are in the same queue). You may also prioritize a call:

```
    $queue
        ->highPriority()
        ->push([
            'command' => 'cache:clear',
        ]);
```

Jobs Monitoring
---------------

[](#jobs-monitoring)

If you use the Doctrine Adapter, you may use Sonata Admin to monitor your jobs:

```
    #
    # more information can be found here http://sonata-project.org/bundles/admin
    #
    sonata_admin:
        # ...
        dashboard:
            # ...
            groups:
                # ...
                System:
                    label:           System
                    icon:            ''
                    items:
                        - admin.queue
```

[![ScreenShot](https://camo.githubusercontent.com/33e0cf35f51290096bf03bb9ec9e5056c4df48b19a62fc5771a0f069c41c5ed2/68747470733a2f2f7261772e6769746875622e636f6d2f6865726973746f702f486572694a6f62517565756542756e646c652f6d61737465722f5265736f75726365732f646f632f736f6e61746161646d696e2e706e67)](https://camo.githubusercontent.com/33e0cf35f51290096bf03bb9ec9e5056c4df48b19a62fc5771a0f069c41c5ed2/68747470733a2f2f7261772e6769746875622e636f6d2f6865726973746f702f486572694a6f62517565756542756e646c652f6d61737465722f5265736f75726365732f646f632f736f6e61746161646d696e2e706e67)

Retry strategy
--------------

[](#retry-strategy)

By default, number of excecution of failed messages is endless. If you use the Doctrine Adapter you may edit the max number of retries on queue table.

To retry all of your failed jobs, you may use this command:

```
    app/console jobqueue:retry [queue-name]
```

If you would like to delete a failed job, you may use this command:

```
    app/console jobqueue:forget [id]
```

Configure a daemon
------------------

[](#configure-a-daemon)

The `jobqueue:listen` command should be runned with the prod environnement and the quiet option to hide output messages:

```
    app/console jobqueue:listen --env=prod --quiet
```

To avoid a memory leak caused by the monolog fingers crossed handler, you may configure the limit buffer size on `config_prod.yml`:

```
    # app/config/config_prod.yml
    monolog:
        handlers:
            main:
                type:         fingers_crossed
                action_level: error
                handler:      nested
                buffer_size:  50
```

Linux ProTip:

To run the command as a service, edit `jobqueue-service` shell in `Resources/bin`. Set the correct `PROJECT_ROOT_DIR` value, and copy this file to `/etc/init.d`.

Then use update-rc.d:

```
    cp jobqueue-service /etc/init.d/jobqueue-service
    cd /etc/init.d && chmod 0755 jobqueue-service
    update-rc.d jobqueue-service defaults
```

To remove the service, use this command:

```
    update-rc.d -f jobqueue-service remove
```

If the service stopped suddenly, you may use `supervisord` to restart it automatically.

A sample config might look like this:

```
  [program:jobqueue-service]
  command=/usr/bin/php %kernel.root_dir%/console jobqueue:listen --env=prod
  directory=/tmp
  autostart=true
  autorestart=true
  startretries=3
  stderr_logfile=/var/log/jobqueue-service/jobqueue.err.log
  stdout_logfile=/var/log/jobqueue-service/jobqueue.out.log
  user=www-data
~
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Total

3

Last Release

3562d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e2c14ee4dd72adb2516c9b82f060cb0536e245fde547e05c72b4e3ec1042d4f?d=identicon)[heristop](/maintainers/heristop)

---

Top Contributors

[![heristop](https://avatars.githubusercontent.com/u/206870?v=4)](https://github.com/heristop "heristop (115 commits)")[![ahmed-k19](https://avatars.githubusercontent.com/u/10832004?v=4)](https://github.com/ahmed-k19 "ahmed-k19 (6 commits)")[![jlirochon](https://avatars.githubusercontent.com/u/149293?v=4)](https://github.com/jlirochon "jlirochon (6 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![shinmen](https://avatars.githubusercontent.com/u/4790740?v=4)](https://github.com/shinmen "shinmen (3 commits)")[![levlexx](https://avatars.githubusercontent.com/u/43851276?v=4)](https://github.com/levlexx "levlexx (2 commits)")[![abrose](https://avatars.githubusercontent.com/u/11835836?v=4)](https://github.com/abrose "abrose (1 commits)")

---

Tags

symfonydoctrinequeuejobrabbitmq

### Embed Badge

![Health badge](/badges/heristop-jobqueue-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/heristop-jobqueue-bundle/health.svg)](https://phpackages.com/packages/heristop-jobqueue-bundle)
```

###  Alternatives

[mmucklo/queue-bundle

Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}

120839.8k](/packages/mmucklo-queue-bundle)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[doesntmattr/mongodb-migrations-bundle

Symfony MongoDBMigrationsBundle

23484.5k1](/packages/doesntmattr-mongodb-migrations-bundle)[mcfedr/queue-manager-bundle

A bundle for managing job queues

1094.3k7](/packages/mcfedr-queue-manager-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
