Creating a Celery worker using node.js

For Celery if the end point is amqp. Checkout Celery.js Github any node process started as amqp consumer would work fine. For every other self.conf.backend_type types you can have varied consumer. Following example is merely for amqp.

One such example. The message below may be the Celery task object.

var amqp = require('amqp');
var connection = amqp.createConnection({ host: "localhost", port: 5672 });
connection.on('ready', function () {
  connection.queue("my_celery_queue", function(queue){
    queue.bind('#'); 
    queue.subscribe(function (message) {
      //eat your Celery work here
    })
  })
})

Leave a Comment