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

jqueue

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jqueue

MySQL backed plugable Node.js job queue based on the Beanstalk Job Lifecycle

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

jqueue

Plugable Node.js job queue based on the Beanstalk Job Lifecycle

Getting Started

Import module

  var jqueueClient = require('jqueue');

Init jqueue

  • dependency: [node-mysql] (https://www.npmjs.com/package/node-mysql)

Important: It's necessary call init before call any other method!

  var jqueueClient = require('jqueue');
  var db = require('node-mysql');
    
  var conncetionInfo = {
    host     : 'set host here',
    user     : 'set user here',
    password : 'set password here',
    database : 'jqueue'
  };

  var dataSource = new db.DB(conncetionInfo);

  var jqueue = new jqueueClient.Jqueue(dataSource);

  jqueue.init(function(error) {
    if(!error) {
      console.log('I am alive!');
    }
  });

Use

parameters: queueName, noCreate, ephemeral, callback;

  • queueName: (STRING) name of the queue to be used, if the queue does not exist it will be created (mandatory);
  • noCreate (BOOLEAN) if true the queue will not be created if it not exist (optional);
  • ephemeral: (BOOLEAN) if true the queue will stored in memory, default: false (optional);
  • callback (FUNCTION) is the callback function (mandatory).
  // disk storage, queue will be created if it not exist
  jqueue.use('myqueue', function(error, queue) {
    if(!error) {
      console.log('I am a queue object', queue);
    }
  });
  // disk storage, queue will not be created if it not exist
  jqueue.use('myqueue', false, function(error, queue) {
    if(!error) {
      console.log('I am a queue object', queue);
    }
  });
  // disk storage, queue will be created if it not exist
  jqueue.use('myqueue', true, function(error, queue) {
    if(!error) {
      console.log('I am a queue object', queue);
    }
  });
  // disk storage, queue will be created if it not exist
  jqueue.use('myqueue', true, false, function(error, queue) {
    if(!error) {
      console.log('I am a queue object', queue);
    }
  });
  // if you want to set memory storage you need to set noCreate parameter

  // memory storage, queue will be created if it not exist
  jqueue.use('myqueue', true, true, function(error, queue) {
    if(!error) {
      console.log('I am a queue object', queue);
    }
  });

Queue

[See Queue Object documentation] (queue)

Message

[See Message Object documentation] (message)

Callbacks standard

The callbacks functions need to respect the callback standard (error, data). So, when you set a callback function, make sure that there at least an error parameter. Even if no error occurs, the error parameter needs to be set, but in this case, the error value will be null.

Keywords

FAQs

Package last updated on 04 Feb 2016

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