BTW the MessageQuery feature is also useful - its an easy way to allow you to add a query to send messages to new consumers to get them 'up to speed' with other consumers.
see QueryBasedSubscriptionRecoveryPolicy and MessageQuery http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/package-summary.html then to implement MessageQuery you could either use a Broker Interceptor or create a consumer in the broker to maintain the counters etc. On 8/8/06, Hiram Chirino <[EMAIL PROTECTED]> wrote:
Sure. Look at On 8/8/06, sparky2708 <[EMAIL PROTECTED]> wrote: > > yes, calculation is very cheap. Just a sum. > > What you describe is exactly what I would like to do (in an ideal case). > We were thinking of creating a module that would attach to an ActiveMQ > broker so a crashed or recently started client would ask the module for the > sum and then start receiving messages from the JMS. > > Although I think ultimately the above is doable but before we take the > hard road it would be interested to know how to track the sum at the broker? In activemq you add your own custom broker type interceptors. Here's an example one: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java?revision=426366&view=markup That example creates 'advisory' messages that get sent to a topic when connections/producers/consumers are created/destroyed. The one bit that is similar to your case is that when a consumer for that advisory topic comes on, it sends that consumer all the events that it had missed so that it know about all the connected connection/consumers/producers. In your case I think you would just need to override the "send(ConnectionContext context, Message messageSend)" call to keep your counters. Also override the " addConsumer(ConnectionContext context, ConsumerInfo info)" So that you can send a message to the consumer with the sum when he gets created. > I guess what I am trying to find out is where on the broker do you keep it > (that would be the ideal solution). Can you give me some examples or point > me to some documentation where I can read about this functionality? > -- > View this message in context: http://www.nabble.com/Leaving-Messages-in-a-Topic.-Any-ideas--tf2069895.html#a5708608 > Sent from the ActiveMQ - User forum at Nabble.com. > > -- Regards, Hiram Blog: http://hiramchirino.com
-- James ------- http://radio.weblogs.com/0112098/
