Skip to content

cantina/cantina-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cantina-queue

Amino queue interface for cantina applications.

Dependencies

Provides

  • app.loadQueueWorkers (dir, cwd) - Loads modules in dir and registers them as queue workers. See Usage for more info. (Automatically loads modules in <app.root>/workers on app start).
  • app.queue (queue, payload) - Schedule work to be done.
  • app.amino.queue - The full amino queue API.

Usage

Expose workers in <app.root>/workers

Modules in this directory will automatically be scanned and registered. Two formats are supported. The preffered format is for the module to export its queue key and worker function like so:

module.exports = function (app) {
  return {
    queue: 'queue:key',
    worker: function (payload, cb) {
      // Do work
      cb();
    }
  };
};

Alternatively, your module can just export the worker function and the basename of the module will be used as the queue key.

Queue work to be done

Use app.queue() to schedule work to be done. Work is asynchronous so you'll need to use events or hooks if other app code needs to know when specific work is completed.

app.queue('queue:key', {my: 'payload'});

Developed by TerraEclipse

Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.

About

Amino queue integration for cantina applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published