1.1.4 • Public • Published

This module provides a useful helper to use the official bull-arena library.

See official documentation here.


The minimum supported version of Node.js is v8.

How to use it

To use the library you just need to follow the following steps.

Install the library with npm:

npm install @condor-labs/bull-arena

Import the library:

const bull = require('@condor-labs/bull-arena')(settings);

settings object properties

Object Property Datatype Default Description
redis port Number 6379 The port number to connect to.
redis host String The hostname of the database you are connecting to.
redis password String The password of that Redis user.
options removeOnComplete, removeOnFail, attempts, etc You can check all the spoible options in the official documentation



module.exports = {
    settings: {
      redis : {
            port: 6379,
            host: "",
            password: "1"
        options : {
            removeOnComplete: 100,
            removeOnFail: 100000,
            attempts: 3


const {
} = require('./constants');

try {
   // init bull-arena object
    const bull = require('@condor-labs/bull-arena')(settings);

    let queueName = 'queue-001';

    const messages = [
      { "data": {
          "id": 1604701460473,
          "entityId": "5fa95d342390fabc79815f4b",
          "data": {
              "header_id": "5fa95d342390fabc79815f4b",
              "sort_by": ["license.professionCode"]
      { "data": {
          "id": 1473604701460,
          "entityId": "c79815f4b5fa95d342390fab",
          "data": {
              "header_id": "15f4b5fa95d342390fabc798",
              "sort_by": ["license.licenseCode"]

    //get a queue instance, If the queue doesn't exist, the queue is created.
    await bull.getQueue(queueName);

    //Add multiple messages to a queue. if the queue doesn't exist, the queue is created.
    await bull.pushBulk(queueName, messages);

    // We can pause the queue
    await bull.pause(queueName);

    //We can also check if the queue is paused.
    let isPausedQueue = await bull.isPaused(queueName);

    //Wait for 10 seconds (JUST FOR TESTING PURPOSES)
    console.log("is paused de queue : ",isPausedQueue);
    setTimeout(async function () {
        console.log("resume the queue after 10 seconds");
        await bull.resume(queueName);
    }, 10 * 1000);

    //We can also add just one message (Job) to a queue. if the queue doesn't exist, the queue is created.
    await bull.add(queueName, `new-job-for-${queueName}`,messages[0], null);

    //The next function is the one we are going to use to process the messages (Jobs) in the queue.
    let job = async function(job){
        console.info(`running job! queue ${job.queue.name}, with id ${job.id} and name ${job.name}`);
        console.log("data sent at job", job.data);
        return true;

    //Finally, we can register the function in the queue to start processing the messages (Jobs).
    await bull.process(queueName,'*',job);

} catch (error) {


A Bull-Arena Queue has the concept of FIRST-IN-FIRST-OUT which can map orders that are carried out simultaneously (asynchronously) to be ordered and take turns one by one (synchronous).

How to Publish

Increasing package version

You will need to update the package.json file placed in the root folder.

identify the property version and increase the right number in plus one.

Login in NPM by console.

 npm login
 [Enter username]
 [Enter password]
 [Enter email]

If all is ok the console will show you something like this : Logged in as USERNAME on https://registry.npmjs.org/.

Uploading a new version

 npm publish --access public

Ref: https://docs.npmjs.com/getting-started/publishing-npm-packages

Note: you will need to have a NPM account, if you don't have one create one here: https://www.npmjs.com/signup


The original author and current lead maintainer of this module is the @condor-labs development team.

More about Condorlabs Here.




npm i @condor-labs/bull-arena

DownloadsWeekly Downloads






Unpacked Size

24.7 kB

Total Files


Last publish


  • daniel.castillo
  • kevin.pedroza_condorlabs.io
  • federico-garcia
  • jorgesanes
  • hjimenez-condorlabs
  • awilches
  • jorgelozano95