[rabbitmq-discuss] Streaming stock prices to long-polling clients
ben.browitt at gmail.com
Tue Oct 20 16:55:40 BST 2009
Thank you. The round-robin and direct exchange were the missing parts.
On Mon, Oct 19, 2009 at 1:24 PM, Matthias Radestock <matthias at lshift.net>wrote:
> Ben Browitt wrote:
> > In my application I need to stream stock prices to users.
> > The 'last price' will be retrieved from a separate service when a
> > consumer connects which simplifies things.
> > Each user will subscribe to several stocks.
> > Users are web browsers connecting using long-polling.
> > Do I create one queue per consumer with several bindings, one for each
> > stock?
> > Prices in this case will be sent with a topic routing key.
> > Another option is to create one queue per stock. each consumer will be
> > subscribed to several queues.
> > Messages will be sent with a direct routing key.
> In the latter case, each quote would only go to one consumer, which is
> probably not what you want. In an AMQP system, to get the same message
> delivered to N consumers you need (at least) N queues. Exchanges *copy*
> messages to queues, whereas queues *round-robin* message delivery to
> Your first setup should work fine, except there is no need to use a
> topic exchange. Just use a direct exchange, one queue per user and for
> each of the stock symbols a user is interested in create a binding
> between the user's queue and the direct exchange.
> > Users will connect using a browser with long-polling to the mochiweb
> > Each user will be presented at the server side as an erlang AMQP client.
> Have you considered using the rabbitmq-jsonrpc-channel plugin? Even if
> you don't want to use it, it's worth taking a look at how it's
> implemented since that may well answer some of your questions regarding
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss