You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by kpalania <kp...@yahoo.com> on 2008/09/18 18:15:49 UTC
Registering Dynamic Listeners
What would be a good way to do this? Basically, this is my requirement -
* Clients send messages to dynamically created JMS destinations via a
Messaging Gateway.
* The gateway has to create dynamic JMS listeners (at runtime, that is) so
that it listens to each of these new destinations that are created
dynamically.
* When messages (or responses) arrive at those destinations, the message
listener should pick them up and do some processing.
I do not want to have a thread that wakes up every so often, runs through
the list of all available destinations and dequeues the messages either in
serial or parallel (multi-threaded). That seems way too error-prone and a
maintenance headache too (to monitor those threads etc). Ideally, I would
want the onMessage() API to be called for each of those destinations.
I just figured a not-so-fool-proof way to identify destinations dynamically
(using DestinationSource and DestinationListener) and I presume I would need
to use that somehow to accomplish what I want here.
Any thoughts? Thanks!
--
View this message in context: http://www.nabble.com/Registering-Dynamic-Listeners-tp19556579p19556579.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Registering Dynamic Listeners
Posted by kpalania <kp...@yahoo.com>.
James.Strachan wrote:
>
>
> This sounds like something Camel could do BTW; we could dynamically
> add new routes based on new Destinations being created?
>
> Another option is that there's actually a statically created consumer;
> but that consumer uses wildcards?
>
> e.g.
>
> from("activemq:Generated.*").bean(Cheese.class).receipientList().header("foo");
>
> then you send to some queue called Generated.XYZ. The final result is
> sent to the value of the 'foo' header?
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>
>
Wild cards - yes. That's exactly what I want to do & verified that it works.
Thanks James!
--
View this message in context: http://www.nabble.com/Registering-Dynamic-Listeners-tp19556579p19560544.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Registering Dynamic Listeners
Posted by James Strachan <ja...@gmail.com>.
2008/9/18 kpalania <kp...@yahoo.com>:
>
> What would be a good way to do this? Basically, this is my requirement -
>
> * Clients send messages to dynamically created JMS destinations via a
> Messaging Gateway.
> * The gateway has to create dynamic JMS listeners (at runtime, that is) so
> that it listens to each of these new destinations that are created
> dynamically.
> * When messages (or responses) arrive at those destinations, the message
> listener should pick them up and do some processing.
>
> I do not want to have a thread that wakes up every so often, runs through
> the list of all available destinations and dequeues the messages either in
> serial or parallel (multi-threaded). That seems way too error-prone and a
> maintenance headache too (to monitor those threads etc). Ideally, I would
> want the onMessage() API to be called for each of those destinations.
>
> I just figured a not-so-fool-proof way to identify destinations dynamically
> (using DestinationSource and DestinationListener) and I presume I would need
> to use that somehow to accomplish what I want here.
This sounds like something Camel could do BTW; we could dynamically
add new routes based on new Destinations being created?
Another option is that there's actually a statically created consumer;
but that consumer uses wildcards?
e.g.
from("activemq:Generated.*").bean(Cheese.class).receipientList().header("foo");
then you send to some queue called Generated.XYZ. The final result is
sent to the value of the 'foo' header?
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com