camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: How to define dynamically the jms uri ?
Date Mon, 20 Oct 2008 16:05:47 GMT
Hi

Ah yeah you can do a lot in DSL but sometimes it just easier to add a plain POJO bean (or
processor) that does the trick, then it's plain readable Java code that everyone knows to
read ;)


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Jonathan Anstey [mailto:janstey@gmail.com] 
Sent: 20. oktober 2008 17:59
To: camel-user@activemq.apache.org
Subject: Re: How to define dynamically the jms uri ?

Sounds like you want to first split quotes.xml using a splitter, then 
set a header containing the topic name, and finally send to a dynamic 
recipient list routing on the header you just created.

So something like this (I haven't tried this, so you may need some small 
edits :) )

from(uri="file=///c:/temp/quotes.xml").splitter(xpath("//price"))
  .setHeader("stock").xpath("/price/@stock", String.class)
  .setHeader("queueName").simple("jms:topic:STOCKS.${in.header.stock}")
  .recipientList(header("queueName"));

cmoulliard wrote:
> Hi,
>
> I would like to know it this is possible to define dynamically the jms uri ?
> I explain.
> In a XML file, I have several lines, one by market symbol :
> <price stock="MSFT" bid="2.008" offer=2.012" movement="2"/>
> <price stock="SUNW" bid="1.34" offer="1.35" movement="2"/>
>
> Depending on the stock name, I would like to send the line to a topic name
> for which the name will be STOCKS.MSFT or STOCKS.SUNW or STOCKS.*. * means
> that depending on the stock name, the stock name must be concatenated to the
> topic STOCKS
>
> from(uri="file=///c:/temp/quotes.xml")
> .to(jms:topic:STOCKS.*)
>
> KR,
>
> Charles Moulliard
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : cmoulliard@xpectis.com
> web site :  www.xpectis.com www.xpectis.com 
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
>   


Mime
View raw message