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: Message Group Overlaps and Load Balancing
Date Mon, 27 Nov 2006 17:27:20 GMT
On 11/21/06, taxingmonk <mkington@webhanger.com> 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="http://activemq.org/config/1.0">
    <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...

http://activemq.org/site/virtual-destinations.html

its all in trunk if you wanna take it for a spin?

-- 

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

Mime
View raw message