| Author |
Message |
< RabbitMQ mailing list ~ Streaming stock prices to long-polling clients |
| Guest |
Posted: Thu Oct 15, 2009 9:52 am |
|
|
|
Guest
|
Hi,
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.
Users will connect using a browser with long-polling to the mochiweb plugin.
Each user will be presented at the server side as an erlang AMQP client.
When using long-polling it is possible that the server sent responses to both connections and have to wait for the user to send a new request.
How do I handle this scenario? Does the erlang client store the messages in its state?
Every time the erlang client gets a new long-polling request it checks for messages in the state,
if there are messages it sends them immediately and if there aren't it keep-alive the request.
Another option is that the erlang client will acknowledge messages only if it can pass it to the web client.
What will happen in this case? Will the queue keep sending new messages or will it wait for the erlang client o 'initialize' the channel?
Are there a suspend and resume features?
Thanks
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Mon Oct 19, 2009 11:24 am |
|
|
|
Guest
|
Ben,
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
consumers.
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 plugin.
> 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
long-polling.
Regards,
Matthias.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Oct 20, 2009 3:56 pm |
|
|
|
Guest
|
Matthias,
Thank you. The round-robin and direct exchange were the missing parts.
Ben
On Mon, Oct 19, 2009 at 1:24 PM, Matthias Radestock <matthias@lshift.net (matthias@lshift.net)> wrote:
Quote: Ben,
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
consumers.
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 plugin.
> 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
long-polling.
Regards,
Matthias.
Post received from mailinglist |
|
|
| Back to top |
|
| business-investment |
Posted: Fri Nov 20, 2009 3:21 pm |
|
|
|
Joined: 20 Nov 2009
Posts: 1
|
|
| Back to top |
|
| Jeminyrider |
Posted: Wed Dec 16, 2009 11:25 am |
|
|
|
Joined: 16 Dec 2009
Posts: 1
|
I am very much appreciate to this good information. Many online penny stocks websites makes available information on hottest stock trends, news alerts etc.
Penny Stocks Report and Penny stock Alerts |
|
|
| Back to top |
|
| AllenMass |
Posted: Thu Dec 24, 2009 9:35 am |
|
|
|
Guest
|
I am very much appreciate to this good information. Many online penny stocks websites makes available information on Penny stocks ,penny stocks trading etc.
Penny Stocks |
|
|
| Back to top |
|
| stock-man |
Posted: Fri Feb 05, 2010 4:40 pm |
|
|
|
Joined: 05 Feb 2010
Posts: 1
|
| even one can subscribe to penny stock newletters for getting regular updates |
|
|
| Back to top |
|
| Tomcleverley |
Posted: Tue Aug 16, 2011 11:47 am |
|
|
|
Joined: 16 Aug 2011
Posts: 2
|
Thanks for the information. This really very knowledgeable for the beginners. I am also decided to invest money in Penny stock picks.
Penny stock picks |
|
|
| Back to top |
|
| Tomcleverley |
Posted: Wed Aug 24, 2011 9:35 am |
|
|
|
Joined: 16 Aug 2011
Posts: 2
|
People invest in stocks for many reasons, the most obvious one is you can make money doing it but there are other reasons such as it is nice to take part in this pastime and can be a fun and rewarding hobby if you work at it
Invest in stocks market |
|
|
| Back to top |
|
| pennystockshark |
Posted: Sat Sep 03, 2011 4:47 am |
|
|
|
Joined: 03 Sep 2011
Posts: 5
Location: USA
|
|
| Back to top |
|
| pennyplayersclub |
Posted: Tue Oct 04, 2011 12:36 pm |
|
|
|
Joined: 04 Oct 2011
Posts: 8
|
Lots of investors are attracted to trade penny stock because it doesn't cost a lot of money to buy any particular stock and you can buy penny stock online for a $100 investment
Hot Penny Stocks
Best Penny Stocks |
|
|
| Back to top |
|
| hotstockpicks |
Posted: Tue Jan 17, 2012 10:40 am |
|
|
|
Joined: 17 Jan 2012
Posts: 1
|
| Thanks for sharing that will be really so valuable. it will be true that in most of the cases the penny stocks investing is found to be unprofitable investments and beginners used to suffer losses in stock trading.Hot Stocks |
|
|
| Back to top |
|
| xtremepicks |
Posted: Mon Jan 30, 2012 9:59 am |
|
|
|
Joined: 10 Jan 2012
Posts: 9
|
| It will be true that A deck is an expansion of your home which can enhance space along with the beauty of the house.Hot Penny Stocks |
|
|
| Back to top |
|
| clubpennystocks |
Posted: Tue Feb 21, 2012 1:19 pm |
|
|
|
Joined: 18 Feb 2012
Posts: 2
Location: http://www.clubpennystocks.com/
|
|
| Back to top |
|
| xtremepicks |
Posted: Mon Feb 27, 2012 5:11 am |
|
|
|
Joined: 10 Jan 2012
Posts: 9
|
|
| Back to top |
|
|
|