You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Woody Dickson <wo...@gmail.com> on 2009/01/18 12:08:13 UTC

Is it possible to pipe a message to multiple queues dynamically?

Hi,

One of the example has this:

from("timer://pollTheDatabase?delay=30000").to("ibatis:selectAllAccounts").to("activemq:queue:allAccounts");

What I want to do is


 <route>
    <from uri="activemq:topic://mytopic"/>
   <to uri="ibatis:selectTopicName"/>
   <multicast>

    <recipientList>
      <deliminter=","/>
    </recipientList>
</multicase>
  </route>

>From the selectTopicName, I can have an sql that will generate
activemq:topic://topicA,activemq:topic://topicB,activemq:topic://topicC
 as the outcome.

But how do I specify the outcome of the "ibatis:selectTopicName" to be
used in recipientList?

I am newbie to camel and activemq, could someone please give me some pointers?

Could someone please show me an example how that can be done?

Any suggestion will be greatly appreciated.

Best Regards,
Woody

Re: Is it possible to pipe a message to multiple queues dynamically?

Posted by huntc <hu...@mac.com>.
Hi Woody,

It depends on whether you mean at the time that all routes are being
established i.e. when your program starts, or each time your timer fires...

Assuming the former (I do not know if the latter is possible), then you
might consider using the fluent builder api approach instead of using XML.
That way, you can produce your routes using Java.

I hope that this helps.

Kind regards,
Christopher

-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-pipe-a-message-to-multiple-queues-dynamically--tp21526540s22882p21532350.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is it possible to pipe a message to multiple queues dynamically?

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Jan 18, 2009 at 12:08 PM, Woody Dickson <wo...@gmail.com> wrote:
> Hi,
>
> One of the example has this:
>
> from("timer://pollTheDatabase?delay=30000").to("ibatis:selectAllAccounts").to("activemq:queue:allAccounts");
>
> What I want to do is
>
>
>  <route>
>    <from uri="activemq:topic://mytopic"/>
>   <to uri="ibatis:selectTopicName"/>
>   <multicast>
>
>    <recipientList>
>      <deliminter=","/>
>    </recipientList>
> </multicase>
>  </route>
>
> From the selectTopicName, I can have an sql that will generate
> activemq:topic://topicA,activemq:topic://topicB,activemq:topic://topicC
>  as the outcome.
>
> But how do I specify the outcome of the "ibatis:selectTopicName" to be
> used in recipientList?
>
> I am newbie to camel and activemq, could someone please give me some pointers?
>
> Could someone please show me an example how that can be done?
>
> Any suggestion will be greatly appreciated.
A good place to look is the recipient EIP pattern wiki:
http://activemq.apache.org/camel/recipient-list.html

It was recently updated documenting how it computes the list of receivers.
It should be something that can be iterated, such as a List<String> or
the likes.

If whatever iBatis returns isn't that you can use a processor to
convert it in Java code

>    <from uri="activemq:topic://mytopic"/>
>   <to uri="ibatis:selectTopicName"/>

<processRef ref="mySpringBeanThatIsAProcessor"/>

>   <multicast>
>
>    <recipientList>
>      <deliminter=","/>
>    </recipientList>
> </multicast>

And then you can have a class that implements
org.apache.camel.Processor where you can set the List<String> as the
IN body yourself.

>
> Best Regards,
> Woody
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/