@tiledesk/tiledesk-multi-worker

0.1.10-rc20 • Public • Published

Jobs-Worker-Queued is a job runner for Node.js. It allows you to define and schedule jobs (arbitrary functions) for execution in a Nodejs worker node using the Rabbit MQ server.

Schema

image

Install

Run the follow command:

npm install --save jobs-worker-queued

Usage

Schedule a job

var JobManager = require("jobs-worker-queued");

var jobManager = new JobManager("amqp://YOUR_RABBIT_URI");


jobManager.publish(
    {name: "job1", address: {city: "NY"}}
);

Run the jobs on the Worker

var JobManager = require("jobs-worker-queued");

var jobManager = new JobManager("amqp://YOUR_RABBIT_URI");


jobManager.run(function(data) {
    console.log("run job here with payload", data)
});

Instantiate different jobs for different tasks

To properly exploit multi-worker, you need to instantiate JobManager using different queueName and topic for each different task. 
The exchange can be unique.

Readme

Keywords

none

Package Sidebar

Install

npm i @tiledesk/tiledesk-multi-worker

Weekly Downloads

668

Version

0.1.10-rc20

License

MIT

Unpacked Size

36.6 kB

Total Files

19

Last publish

Collaborators

  • andrealeo83
  • nicolan74
  • dariodepa
  • andreasponziello
  • gab95
  • eljohnny