[rabbitmq-discuss] How to use Long Polling with RabbitMQ and Rails

Michael Klishin michael.s.klishin at gmail.com
Thu Aug 4 21:03:57 BST 2011


2011/8/4 sid__ <sid.ravichandran at gmail.com>

> I am unable to figure how one would go about doing this. Since they
> run on separate ports there would be the issue of violating the same
> origin policy.
>
> I am familiar with how Orbited provides long polling support for XMPP
> but I was unable to find something similar for AMQP. But how would the
> AMQP server respond without and explicit HTTP Request handler.
>
> I would really appreciate some help on how this should be implemented.
> Some sample code would be great.
>
>
You can combined multiple EventMachine-based servers in the same process.
You can combine em-websocket, amqp gem and something that helps you with
long polling (it probably can be something Thin or Goliath-based).


> Also I would like to know if the general practice is to run the AMQP
> server as daemon or as part of Rails app.
>

I typically recommend running amqp daemons as satellite applications but
there are certainly cases when people run amqp daemons
basically embedded into Web applications. Just keep in mind Ruby 1.8.7
threading scheduler is not really fair (some threads may be given
significantly more time to run than others) and while 1.9.2 uses kernel
threads that are a lot better in this regard, I have seen obscure 1.9.2 VM
crashes with  multithreaded applications.

-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110805/867c1be5/attachment.htm>


More information about the rabbitmq-discuss mailing list