activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: included: fully functional (almost) quote producer
Date Wed, 25 Oct 2006 14:32:04 GMT
On 10/24/06, millerkdm <millerkdm@yahoo.com> wrote:
>
> Thanks James! I did not know about the single-producer thing. I will
> definitely give it a try.
>
> I have thought about the last-message thing before, and I don't think it
> will work, as there are a couple hundred thousand symbols, most of which
> will never have a subscriber.

You can just a simple LRU cache of a fixed size with TimeToLive to
keep on top of RAM usage etc


> So, when a user does subscribe to a new
> symbol, there may be no last message to send.

OK


>  And as memory consumption is
> definitely an issue with ActiveMQ, I do not want to keep all those quotes
> around in memory, anyway.  Also, since some quotes will not update for
> hours, or even days, I need to make sure the user always gets the last
> quote, and  my best solution, so far, is to just have the client request the
> last quote when he subscribes to a symbol. Not elegant, but simple.

FWIW you could integrate in the 'request the last quote' service into
the broker so its hidden from the client if you wish.

So you just need to implement this interface
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/MessageQuery.html

and use the QueryBasedSubscriptionRecoveryPolicy
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/QueryBasedSubscriptionRecoveryPolicy.html

-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message