On 16/11/2007, Robert Ginda <[EMAIL PROTECTED]> wrote:
> Hi.  I'm using AMQ for my first time on a new project, and I could use
> a little guidance.
>
> I'm recording events off of a queue using a message group, and would
> like to fan the message out to other consumers on the same java
> thread.  The other consumers will only want to see a subset of
> messages, and they will be configured and re-configured fairly
> regularly.  Also, these consumers may be nested arbitrarily deep.
>
> One approach would be to have a single consumer, and come up with my
> own application specific way to decide which objects to notify.  A
> message would arrive at a consumer, and it would walk through a list
> of objects to determine whether or not it should be notified of this
> message.  It's doable, but seems like a waste of effort.
>
> I'd prefer to express the notification criteria as a message selector.
>  I've read about Filtered Destinations, and they sound like what I'm
> looking for, except they involve the broker.  Configuration lives on
> the broker, and will presumably send the message individually to each
> consumer.
>
> Is there a way to set up something like a consumer-side filtered destination?

So you could just start and stop individual consumers and bind each
consumer to your POJOS; letting the JMS provider do your filtering for
you. The only downside is if you need to change your selector, you
need to stop/restart your consumer. This stopping/starting of
consumers can be a bit tricky with topics (as you can miss messages) -
but is no biggie with queues.

Another approach is to consume all messages on the queue you want to
dispatch then use some kinda Content Based Router in your consumer to
dispatch it to all interested objects...
http://activemq.apache.org/camel/content-based-router.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Reply via email to