Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bull-qm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bull-qm

Queue Manager for Bull

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-54.55%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status

Queue Manager for Bull

If you use Bull, you've probably run into a situation in which the number of connections to your redis server skyrocketed. Why? Because each instance of your queues created 3 connections and each instance of your application created each queue. Easily racking up thousands of connection.

Enter the Queue Manager. At least now you can limit the number of connections a single instance makes!

QueueManager ⇐ EventEmitter

QueueManager

Kind: global class
Extends: EventEmitter

new QueueManager()

A QueueManager handles the complexity of reusing redis connections. Without reusing redis connections, the number clients connected to redis at any given time can sky rocket.

manager.NUM_CLIENTS

Returns the number of clients connected via this QueueManager (helper for tests)

Kind: instance property of QueueManager

manager.client ⇒ IORedis

Returns the client for this QueueManager

Kind: instance property of QueueManager
Returns: IORedis - Client (used for redis cmds)

manager.subscriber ⇒ IORedis

Returns the subscriber instance for this manager. Creates it if it does not exist;

Kind: instance property of QueueManager
Returns: IORedis - Subscriber client

manager.enqueue(name, data, opts) ⇒ Promise.<Job>

Adds a job to a queue with the given name. Relies on QueueManager.getQueue which means the queue will be created. If the queue needs to have special options, make sure the queue is created by using getQueue/createQueue first.

Kind: instance method of QueueManager
Returns: Promise.<Job> - The Job created by Bull

ParamTypeDescription
namestringThe name of the queue
dataObjectThe data property for the new job
optsJobOptsBull job options.

manager.hasQueue(name) ⇒ Boolean

Simple function to test if a queue has been created or not.

Kind: instance method of QueueManager
Returns: Boolean - True if the queue has been created, false otherwise

ParamTypeDescription
namestringThe name of the queue

manager.getQueue(name, options) ⇒ BullQueue

Gets a specific queue. Creates it if the queue does not exist. If a queue needs special configuration options, they can be called on the first instance of getQueue. QueueManager.createQueue is aliased to this function, so syntactically, you can use that function to denote creation.

Kind: instance method of QueueManager
Returns: BullQueue - The created bull queue

ParamTypeDescription
namestringThe name of the queue to create
optionsObjectOptions to pass to bull. Options here will override any options provided by default.

manager.getAllQueues() ⇒ Array.<BullQueue>

Returns an array of all queues

Kind: instance method of QueueManager
Returns: Array.<BullQueue> - array of bull queues

manager.shutdown() ⇒ Promise

Closes all queues managed by this QueueManager

Kind: instance method of QueueManager
Returns: Promise - Resolves when all queues have been closed

manager.createClient(type, redisOpts) ⇒ IORedis

Manages the clients used by queues in this QueueManager instance. Bull can reuse subscriber and client connections, but needs to create separate bclient instances for each queue. This means that the number of clients you have is directly tied to the number of queues you have.

Kind: instance method of QueueManager
Returns: IORedis - An instance of IORedis
See: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md#reusing-redis-connections

ParamTypeDescription
typestringType of redis client
redisOptsIORedisOptsThe options to pass to redis.

manager.createQueue(name, options) ⇒ BullQueue

Gets a specific queue. Creates it if the queue does not exist. If a queue needs special configuration options, they can be called on the first instance of getQueue. QueueManager.createQueue is aliased to this function, so syntactically, you can use that function to denote creation.

Kind: instance method of QueueManager
Returns: BullQueue - The created bull queue

ParamTypeDescription
namestringThe name of the queue to create
optionsObjectOptions to pass to bull. Options here will override any options provided by default.

License

© 2020 Mudrekh Goderya MIT

Keywords

FAQs

Package last updated on 14 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc