开发者

Job queue in node.js

I'm looking for a job queue manager in node.js开发者_如何学C which can be invoked by php. This is for a web application which needs to send emails, create pdf files and so on which I'd like to perform asynchronous of the php process.

Example of the process:

  1. User requests a php page
  2. Php invokes the job queue manager and adds a task
  3. Task is executed in node.js asynchronously of php, preferably when it's a bit more quiet
  4. Task is to execute a php script

Why this "complex" system?

  1. We write all our web-applications in php (Zend Framework)
  2. We'd like to start learning node.js
  3. We need a asynchronous process (fast response!)
  4. The "real" task should be a php script as well, to utilize already written php classes, to have easy access to database connections and be as much DRY as possible

Use cases of this system:

  1. User registers himself, system will send welcome email
  2. User completes ecommerce order, system will send invoice

In the end, we'd like to use node-cron as well, to perform non-system wide cron tasks (very application specific). Node-cron will invoke the job queue manager, which will subsequently run a php script.

Is there such an application already in node?


In such a case I would prefer a message queue like RabbitMQ and client side libraries like node-amqp and php-amqp. Then simply send your job from your PHP script in the queue and let nodejs pick up the job from the queue. A big advantage is that it is extensible and it is widely used and tested in the enterprise market.


One possible options is node-jobs, which uses Redis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜