PHPackages                             markup/job-queue-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. [Queues &amp; Workers](/categories/queues)
4. /
5. markup/job-queue-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

markup/job-queue-bundle
=======================

The Markup Job Queue bundle integrates with oldsound/rabbiitmq-bundle to provide automatic scheduling of recurring console command jobs

8.2.2(3y ago)1759.6k7[3 issues](https://github.com/usemarkup/JobQueueBundle/issues)[1 PRs](https://github.com/usemarkup/JobQueueBundle/pulls)MITPHPPHP &gt;=7.1

Since Dec 20Pushed 3y ago21 watchersCompare

[ Source](https://github.com/usemarkup/JobQueueBundle)[ Packagist](https://packagist.org/packages/markup/job-queue-bundle)[ RSS](/packages/markup-job-queue-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (20)Versions (22)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a0c7b009095ea671a5e1098965363fc833eb34c7aabc2a170b7f7428840c1cf1/68747470733a2f2f6170692e7472617669732d63692e6f72672f7573656d61726b75702f4a6f62517565756542756e646c652e737667)](http://travis-ci.org/usemarkup/JobQueueBundle)

Introduction
============

[](#introduction)

This bundle provides a few features for providing a simple job queue mechanic and scheduling system for symfony console commands. It uses rabbit-mq to manage a job queue, (for which various workers process tasks). Before proceeding you should read: . This bundle assumes the use of 'topic' consumers rather than 'direct' consumers.

These workers should be maintained by supervisord to ensure they don't fail.

Features
========

[](#features)

- Add console command jobs to RabbitMq to be handled asyncronously
- Add jobs to run at a date in the future
- Log the status of jobs (status, peak memory use, output etc) in redis via uuid option added to all console commands
- Consume Jobs with a PHP consumer or Golang consumer (thanks to ricbra/rabbitmq-cli-consumer)
- Helper command for generating config to manage consumers with Supervisord

Scheduling Jobs
---------------

[](#scheduling-jobs)

Rather than scheduling console commands using the crontab, they should be managed in environment specific configuration files (using crontab syntax). This allows the addition of new recurring jobs, or changing of timings, without having to modify crontab in multiple environments. It also has the advantage of forcing a common logging/exception notification strategy for all commands. Examples of these sorts of tasks are polling third party servers for files, sending spooled email or generating reports.

Configuration
-------------

[](#configuration)

```
markup_job_queue:
    recurring: recurring_jobs.yml # name of file within app/config/
```

```
# app/config/recurring_jobs.yml
- command: your:console:command --and --any --options and arguments
  schedule: 1-59/2 * * * *
  topic: topic-of-a-configured-rabbitmq-producer # e.g 'default'
- command: another:console:command --and --any --options and arguments
  schedule: * * * * *
  topic: topic-of-a-configured-rabbitmq-producer
```

Once you have configured your recurring schedule you need to add only one console command to your live crontab. This will run a single console command every minute adding any 'due' jobs to RabbitMQ for processing:

```
* * * * * /usr/bin/php /your/app/location/current/app/console markup:job_queue:recurring:add --no-debug -e=prod >> /var/log/recurring_jobs.log
```

In development instead of installing to the crontab you can run on an interval in the command line if you prefer:

```
while true; do app/console markup:job_queue:recurring:add; sleep 60; done
```

For the value of 'topic' a valid consumer and producer need to be set up in the oldsound/rabbitmq-bundle configuration as follows, without a configuration of this type, processing of the job will fail (this is currently a convention but would be better enforced by allowing this bundle to configure the oldsound bundle directly - PR's welcome): **Due to the way oldsound/rabbitmq-bundle treats certain keys, do not use hypens in producers and consumers.**

```
producers:
    a_valid_topic:
        connection:       default
        exchange_options: { name: 'a_valid_topic', type: topic }

consumers:
	a_valid_topic:
		connection:       default
		exchange_options: { name: 'a_valid_topic', type: topic }
		queue_options:    { name: 'a_valid_topic' }
		callback:         markup_job_queue.consumer
```

There are a few console commands that allow you to preview and validate your configured console jobs via the CLI (see /Command)

Adding Jobs
-----------

[](#adding-jobs)

Jobs can also be added directly. There is a utility method for adding 'command' jobs, which uses the Symfony process component to execute console commands. Adding a 'Command Job' can be achieved using the 'jobby' service as follows:

```
$container->get('jobby')
	->addConsoleCommandJob(
		'your:console:command',
		['--test']
		'a_valid_topic', # should be a valid topic name
		600, # allowed timeout for command (see symfony process component documentation)
		600, # allowed idle timeout for command (see symfony process component documentation)
	)
```

You can use this mechanism to break down large import tasks into smaller sections that can be processed asynchronously. Make sure you appropriately escape any user provided parameters to your console commands. Due to the way that console commands are consumed using the Process component, unescaped parameters are a possible security attack vector.

Enabling and Monitoring Workers (via supervisord)
=================================================

[](#enabling-and-monitoring-workers-via-supervisord)

To aid with deployment of this bundle, a console command has been provided which can be run as part of a deployment. This console command will generate a supervisord file for the purpose of including within your main supervisord.conf file. This will produce a configuration that initiates and watches php 'consumers', providing one consumer per topic. There are two options for consuming jobs. The default mechanism is to use the PHP consumers provided by oldsound/rabbitmq-bundle, but an alternative mechanism uses the Golang based consumer (ricbra/rabbitmq-cli-consumer). To use the Golang variant, provide a configuration for the `cli_consumer` node.

```
markup_job_queue:
	cli_consumer:
	    enabled: true
```

This console command requires a minimal configuration (one block for each consumer you want to start). By convention these must match the consumers you have already defined (as seen above). **Due to the way oldsound/rabbitmq-bundle treats certain keys, do not use hypens in your topic names.**:

By setting 'prefetch\_count' you can select how many messages the consumer should process before respawning.

```
markup_job_queue:
	topics:
		test:
			prefetch_count: 10
		a_valid_topic:
			prefetch_count: 20
```

To write the configuration file:

```
app/console markup:job_queue:supervisord_config:write disambiguator
```

The file will be written to /etc/supervisord/conf.d/ by default. This can be amended:

```
markup_job_queue:
	supervisor_config_path: /path/to/conf/file/
```

This path needs to be included in your main /etc/supervisord.conf thus:

```
[include]
files=/path/to/conf/file/*.conf

```

Deployment
==========

[](#deployment)

To use this as part of a capistrano deployment for example you can write some custom capistrano tasks that:

- Stop consumers
- Rewrite the configuration
- Restart the consumers

The following assumes use of capistrano multistage under capifony 2.X YMMV

```
namespace :supervisor do
    	desc "Supervisor Tasks"
    	task :check_config, :roles => :app do
		stream "cd #{latest_release} && #{php_bin} #{symfony_console} markup:job_queue:recurring:check --env=#{symfony_env}"
	end
	task :write_config, :roles => :worker, :except => { :no_release => true } do
	        stream("cd #{latest_release} && #{php_bin} #{symfony_console} markup:job_queue:supervisord_config:write #{fetch(:stage)} --env=#{symfony_env_prod};")
	end
	task :restart_all, :roles => :app, :except => { :no_release => true } do
		stream "#{try_sudo} supervisorctl stop all #{fetch(:stage)}:*"
		stream "#{try_sudo} supervisorctl update"
		stream "#{try_sudo} supervisorctl start all #{fetch(:stage)}:*"
		capifony_puts_ok
	end
	task :stop_all, :roles => :app, :except => { :no_release => true } do
		# stops all consumers in this group
		stream "#{try_sudo} supervisorctl stop all #{fetch(:stage)}:*"
		capifony_puts_ok
	end
end
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 55.1% 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 ~55 days

Recently: every ~180 days

Total

20

Last Release

1281d ago

Major Versions

6.0.9 → 7.0.02020-07-09

7.2.0 → 8.0.02020-11-24

PHP version history (2 changes)6.0.1PHP &gt;=7.1.0

6.0.5PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![calumbrodie](https://avatars.githubusercontent.com/u/459459?v=4)](https://github.com/calumbrodie "calumbrodie (124 commits)")[![gsdevme](https://avatars.githubusercontent.com/u/319498?v=4)](https://github.com/gsdevme "gsdevme (53 commits)")[![shieldo](https://avatars.githubusercontent.com/u/97280?v=4)](https://github.com/shieldo "shieldo (18 commits)")[![oantonelli](https://avatars.githubusercontent.com/u/10195728?v=4)](https://github.com/oantonelli "oantonelli (13 commits)")[![danieloraca](https://avatars.githubusercontent.com/u/2079380?v=4)](https://github.com/danieloraca "danieloraca (5 commits)")[![ChrisDBrown](https://avatars.githubusercontent.com/u/3877652?v=4)](https://github.com/ChrisDBrown "ChrisDBrown (3 commits)")[![redjam13](https://avatars.githubusercontent.com/u/4730079?v=4)](https://github.com/redjam13 "redjam13 (2 commits)")[![NeilMasters](https://avatars.githubusercontent.com/u/6899269?v=4)](https://github.com/NeilMasters "NeilMasters (2 commits)")[![volkan](https://avatars.githubusercontent.com/u/28885?v=4)](https://github.com/volkan "volkan (1 commits)")[![bazgear](https://avatars.githubusercontent.com/u/1312825?v=4)](https://github.com/bazgear "bazgear (1 commits)")[![iain-matchett](https://avatars.githubusercontent.com/u/34270316?v=4)](https://github.com/iain-matchett "iain-matchett (1 commits)")[![kardi31](https://avatars.githubusercontent.com/u/9740794?v=4)](https://github.com/kardi31 "kardi31 (1 commits)")[![astalker](https://avatars.githubusercontent.com/u/1486567?v=4)](https://github.com/astalker "astalker (1 commits)")

---

Tags

queuejobcronrecurringrabbit\_mq

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markup-job-queue-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/markup-job-queue-bundle/health.svg)](https://phpackages.com/packages/markup-job-queue-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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