chrisboulton / php-resque

PHP port of resque (Workers and Queueing)
MIT License
3.43k stars 759 forks source link

It's possible to send jobs from PHP to workers running on Node? #184

Closed JCMais closed 9 years ago

JCMais commented 10 years ago

This is more a question (2 in reality) than a issue.

Both ports say that are compatible with the original resque implementation, so It's possible to add jobs to the queue from php, using php-resque, and leave the workers on node, using node-resque?

Also, the workflow to have an "infinite" job, is like the following:

  1. App send job with determined args to queue.
  2. Worker grabs Job and does some processing.
  3. Worker sends Job back to queue with updated args.
  4. 2 repeats.

Is that correct? Am I going to find any issue doing it that way, that is, there is a better way?

I was going to post that on SO under php-resque tag, but the activity there is lower than here. (:

danhunsaker commented 10 years ago

The in-Redis data should be identical between all three, yes. You'll have to be sure to construct your class names and such accordingly, of course; if Node can't find the class, it can't run the job any more than PHP can if it can't find the class.

That's as decent a way as any. It'll technically be a different job, though, most likely, because the job ID is set during enqueue, and there isn't a mechanism for supplying your own. I think there's a requeue method buried in there someplace, but I wouldn't rely on it, myself. A changing job ID doesn't mean much in the long run.

You'll probably want to make sure that job reports its activity somewhere so you can keep an eye on whether it's doing its job or not. But you probably already know that and intend to do so without my prodding.