[rabbitmq-discuss] WebSockets and Rabbit-mq
majek04 at gmail.com
Thu Oct 20 12:00:52 BST 2011
On Wed, Oct 19, 2011 at 21:23, Paul Cowan <dagda1 at scotalt.net> wrote:
> I am struggling to work out how I can communicate between rabbitmq and
> My are requirements for the piece of work are this.
> I want a user to be able to kick off from a web page a long running process
> that could take at least 20 minutes to finish.
> I want the process to complete even if the user closes down the browser.
> While the user still has the browser open, I want the user to be able to get
> real time updates of the long running process displayed in the browser.
> My thoughts are that the client script on the page will create a websocket
> connection that will kick off an EventMachine-Websocket instance on the
> server (I am using Ruby on Rails).
> The websocket instance will subscribe to an AMQP queue that will complete
> the long running process even if the browser is closed down.
> I am struggling with how the em-websocket instance will receive updates of
> the work that is being done which is effectively inserts into a database.
> Do I need 2 queues? One to start the process and one to receive updates or
> is there a better way?
Yes. You need one queue on which the consumer (that does the job)
will listen. And another, possibly anonymous, queue that will be created
for every user/browser. (and quickly destroyed when the user goes away).
> Can anybody shed any advice on this situation? Has anybody done anything
It is quite a simple scenario, I'm sure many people did something like that,
Also, this may be of interest: http://sockjs.org
More information about the rabbitmq-discuss