activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taxingmonk <>
Subject Re: Message Group Overlaps and Load Balancing
Date Mon, 27 Nov 2006 17:57:32 GMT

Hi James,

Yup, this should also work, the only thing that is nice about the previous
approach is that programatically I can change the partitioning.  Either by
providing a wrapper to producing the message (and dynamically defining which
queues to send to), or doing the same by consuming the message from the
"master" queue and republishing.

p.s. Built with MVN2 these days?

James.Strachan wrote:
> On 11/21/06, taxingmonk <> wrote:
>> Hi James,
>> To quote: "If you just want load balancing you could use 1 queue with a
>> selector
>> for each group."
>> Yes, that'd be fine, the problem is that I want an overlap. Having done
>> further testing I realise this is a flawed notion in and of itself, I'm
>> inadvertently expecting a queue to duplicate messages for the overlapping
>> selectors.
>> Another way to describe the intending behaviour would be to have a set of
>> consumers on a topic where groups of consumers could be made where one
>> consumer in the group and only one receives a copy of the message for
>> that
>> group. Thus I can build a replicated distributed queue. The net result is
>> actually identical to using multiple queues and composite destinations.
>> I think your suggestion:  "So send a message to an input queue then have
>> a
>> farm of routers consuming them and routing them to the correct queue for
>> the
>> right group to process it." is the closest, when I was first thinking up
>> a
>> solution for this using composite destinations I was hoping to hide the
>> building of the composite destination from the sender.  This seems like a
>> nice way to do it.
> Actually on reflection; Virtual Destinations should be able to use
> selectors so you can do exactly what you need. Then you'd not need to
> write any code - just configure a virtual destination.
> I've patched the Virtual Destination support in trunk so that you can
> configure a virtual destination as follows...
>   <broker xmlns="">
>     <destinationInterceptors>
>       <virtualDestinationInterceptor>
>         <virtualDestinations>
>           <compositeQueue name="MY.QUEUE">
>             <forwardTo>
>               <filteredDestination selector="foo = 'bar'"
> queue="Groups.A"/>
>               <filteredDestination selector="x = 5" queue="Groups.B"/>
>             </forwardTo>
>           </compositeQueue>
>         </virtualDestinations>
>       </virtualDestinationInterceptor>
>     </destinationInterceptors>
> So that if you send to queue MY.QUEUE then messages will be sent to
> queues Group.A and Group.B if they match the selectors defined for
> them.
> More docs on this page...
> its all in trunk if you wanna take it for a spin?
> -- 
> James
> -------

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message