开发者

What is the best way to schedule job from Rails to EventMachine server?

I've created开发者_如何学C eventmachine app that perform some background job. I wonder what is the best way to send data from rails app to eventmachine app.

Currently Im thinking of using redis for this. Perhaps redis pub/sub functionality.

Is there any gem that can be used for this task?


Without knowing more about your needs I cannot give a precise answer but here are some leads:

  • RabbitMQ as mentionned
  • Redis with subscriptions or lists
  • ZeroMQ (your rails application would open a connection directly to your background eventmachine process and then closes it when done)
  • Raw TCP/UDP (if you are needs are really simple)

If you already have a redis server you can use its subscribe/publish feature or another thing I did which is to have a process do a brpop or blpop (the process will block on the call and take anything put in the queue right away) on a list and have your rails process push something to the list, it works pretty well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜