You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Goyal, Arpit" <ar...@sap.com> on 2013/09/26 16:59:36 UTC

Dynamic generation of URI in enricher

Hi All,



I would like to use enricher along with dynamic URI (See sample XML below), where the URI is my custom endpoint. I know we can't do the same in camel:to and we would need to use it camel:recipientList (http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html)



<camelContext id="test" streamCache="true">

                <route>

                                <from uri="file:///tmp/inbox"/>

                                <setHeader header="id">

                                                <xpath resultType="java.lang.String">//result/@id</xpath>

                                </setHeader>

                                <enrich uri="mySql:operation=querySync&query=SELECT * FROM MyTable WHERE id = '${header.id}'" strategyRef="query-service"/>

                                <to uri="file:///tmp/outbox/>

                </route>

</camelContext>



Or I need to handle in my custom endpoint?



Thanks & Regards,

Arpit.


Re: Dynamic generation of URI in enricher

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

Not possible. See the red box in the documentation
http://camel.apache.org/content-enricher.html

On Thu, Sep 26, 2013 at 3:59 PM, Goyal, Arpit <ar...@sap.com> wrote:
> Hi All,
>
>
>
> I would like to use enricher along with dynamic URI (See sample XML below), where the URI is my custom endpoint. I know we can't do the same in camel:to and we would need to use it camel:recipientList (http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html)
>
>
>
> <camelContext id="test" streamCache="true">
>
>                 <route>
>
>                                 <from uri="file:///tmp/inbox"/>
>
>                                 <setHeader header="id">
>
>                                                 <xpath resultType="java.lang.String">//result/@id</xpath>
>
>                                 </setHeader>
>
>                                 <enrich uri="mySql:operation=querySync&query=SELECT * FROM MyTable WHERE id = '${header.id}'" strategyRef="query-service"/>
>
>                                 <to uri="file:///tmp/outbox/>
>
>                 </route>
>
> </camelContext>
>
>
>
> Or I need to handle in my custom endpoint?
>
>
>
> Thanks & Regards,
>
> Arpit.
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen