Node client for IronWorker

npm install iron_worker
1 downloads in the last day
22 downloads in the last week
153 downloads in the last month

iron_worker_node is NODE.JS language binding for IronWorker.

IronWorker is a massively scalable background processing system. See How It Works

Getting Started

1. Install the gem:

npm install iron_worker

2. Setup your credentials

3. Create an IronMQ Client object:

var iron_worker = require('iron_worker');
var worker = new iron_worker.Client();

Or pass in credentials:

var worker = new iron_worker.Client({token: "MY_TOKEN", project_id: "MY_PROJECT_ID"});

Creating a Worker

Here's an example worker:

console.log("Hello Node World!");

Upload code to server

Using CLI tool (preferred)

  • Get CLI tool
  • Download or create iron.json config file with project_id/password
  • Create HelloWorld.worker file, example:
runtime 'node'
exec 'HelloWorld.js'
  • Upload!
$ iron_worker upload HelloWorld

.worker syntax reference

Worker examples

You can find plenty of good worker examples here: iron_worker_examples

Queueing a Worker

var task_id = worker.tasksCreate('HelloWorld');

Worker should start in a few seconds.

Status of a Worker

To get the status of a worker, you can use the tasksGet() method.

var task_id = worker.tasksCreate('HelloWorld');
details = worker.tasksGet(task_id);

Get Worker Log

Use any function that print text inside your worker to put messages to log.

var task_id = worker.tasksCreate('HelloWorld');
worker.tasksWaitFor(task_id, function (err, res) {
    worker.tasksLog(task_id, function (err, res) {console.log(res)});

Full Documentation

You can find more documentation here:

npm loves you