Skip to content
A generic job queue module for Magento2
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

GPL licensed

Magento2 Job Queue

This module provides functionality to schedule and run jobs in a queue for Magento2. The basic idea is to allow developers to defer tasks that would otherwise delay the page load time and cause site slowness. Example use cases may be sending an email, communicating with a remote API, or running cleanup tasks in the background.

While originally written for our Springbot Magento2 integration, this module can be utilized for many other use cases.

The module provides both programmatic and command line ways to enqueue, run, and view jobs. The key components of a job are a fully qualified class name, a method name, and a list of arguments. There are a few requirements: the class must be autoloadable, the method must be public, and the params must not contain objects. Additional options are priority, queue name, and "run at" time.


Composer is the preferred method of installation:

composer require springbot/magento2-queue
php bin/magento module:enable Springbot_Queue

Command line usage

Enqueue a job

 php bin/magento springbot:queue:enqueue <class> <method> [<queue>] [<priority>] [<params>1] ... [<params>N]

List current jobs in the queue

 php bin/magento springbot:queue:list

Process the queue

php bin/magento springbot:queue:process

Programmatic usage


namespace Your\Name\Space;

use Springbot\Queue\Model\Queue;

class QueueExample
    private $queue;

     * QueueExample constructor
     * @param Queue $queue
    public function __construct(Queue $queue)
        $this->queue = $queue;

     * Queue examples
    public function runQueueExamples()
        // Enqueue a job 
        $this->queue->scheduleJob('\Fully\Qualified\ClassName', 'methodToRun', ['arg1', 'arg2']);
        // Process the queue 
        // Get a collection of current jobs
        $jobs = $this->queue->getCollection();

API Usage

To process the queue make a GET request to the following API endpoint:


To view current jobs make a GET request to the following API endpoint:


For security purposes jobs cannot be enqueued directly from the web API.

You can’t perform that action at this time.