You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bozo Juretic <bj...@inet.hr> on 2009/01/03 10:47:15 UTC

Dynamically selecting a transformation template

Hello all,

I have a normalized XML message on the input of a route and would like 
to transform this message using the XQuery to the intermediary format 
used by the MINA encoder in the next phase, but based on some message 
properties (protocol, upstream connection etc.) I would send this 
message to the specific to().

What I'm doing is taking the message and sending it 
to("xquery:someTemplate"). This all works well. The question is how do I 
actually dynamically insert a templateName (location of a XQuery 
template), based on some of the message properties?

I would like to have some variable which I can place in to("xquery:" + 
myDynamicTemplate). I have many templates thus creating one big choice() 
would defeat the purpose of using Camel Java DSL as a simple routing 
language.

Thank you and best regards,

Bozo Juretic


Re: Dynamically selecting a transformation template

Posted by Bozo Juretic <bj...@inet.hr>.
Hi Claus,

yes, that's it!

Thank you,

Bozo

Claus Ibsen wrote:
> Hi
>
> Sounds like the dynamic recipient list EIP pattern
> http://activemq.apache.org/camel/recipient-list.html
>
> You can add a header with the destination. The header value should
> then be: "xquery:" + myDynamicTemplate
>
> On Sat, Jan 3, 2009 at 10:47 AM, Bozo Juretic <bj...@inet.hr> wrote:
>   
>> Hello all,
>>
>> I have a normalized XML message on the input of a route and would like to
>> transform this message using the XQuery to the intermediary format used by
>> the MINA encoder in the next phase, but based on some message properties
>> (protocol, upstream connection etc.) I would send this message to the
>> specific to().
>>
>> What I'm doing is taking the message and sending it
>> to("xquery:someTemplate"). This all works well. The question is how do I
>> actually dynamically insert a templateName (location of a XQuery template),
>> based on some of the message properties?
>>
>> I would like to have some variable which I can place in to("xquery:" +
>> myDynamicTemplate). I have many templates thus creating one big choice()
>> would defeat the purpose of using Camel Java DSL as a simple routing
>> language.
>>
>> Thank you and best regards,
>>
>> Bozo Juretic
>>
>>
>>     
>
>
>
>   

Re: Dynamically selecting a transformation template

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Sounds like the dynamic recipient list EIP pattern
http://activemq.apache.org/camel/recipient-list.html

You can add a header with the destination. The header value should
then be: "xquery:" + myDynamicTemplate

On Sat, Jan 3, 2009 at 10:47 AM, Bozo Juretic <bj...@inet.hr> wrote:
> Hello all,
>
> I have a normalized XML message on the input of a route and would like to
> transform this message using the XQuery to the intermediary format used by
> the MINA encoder in the next phase, but based on some message properties
> (protocol, upstream connection etc.) I would send this message to the
> specific to().
>
> What I'm doing is taking the message and sending it
> to("xquery:someTemplate"). This all works well. The question is how do I
> actually dynamically insert a templateName (location of a XQuery template),
> based on some of the message properties?
>
> I would like to have some variable which I can place in to("xquery:" +
> myDynamicTemplate). I have many templates thus creating one big choice()
> would defeat the purpose of using Camel Java DSL as a simple routing
> language.
>
> Thank you and best regards,
>
> Bozo Juretic
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/