You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by AlanFoster <al...@alanfoster.me> on 2012/08/14 13:52:41 UTC

Using Simple header notation to define where to send a message

Hi,

I'm wondering if it's possible to define a header to set up where an
exchange should be send to, then access it through simple within the "to"
uri.

For instance I have one route which sets up what service I need to send a
message to.
Then the other message sends it to the required service, then does all
appropriate response handling based on the status code returned.

<route id="routingLogic">
    <from uri="activemq:etc" />
    
    <setHeader headerName="serviceAddress">
        <constant>cxf:bean:example</constant>
    </setHeader>
    
    <to uri="direct:sendingLogic" />
</route>

<route>
   <from "direct:sendingLogic" />
    
   <to uri="${headers.serviceAddress}" />
   
   <setHeader
headerName="responseCode"><xpath>//foo/bar/responseCode</xpath><setHeader>
    <choice>
       ....
    </choice>
</route>

I am wondering if it is possible to use anything like this? As I currently
get the error of 

Caused by: org.osgi.service.blueprint.container.NoSuchComponentException: No
component with id '${headers.serviceAddress}' could be found

Thanks

Alan



--
View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-header-notation-to-define-where-to-send-a-message-tp5717318.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using Simple header notation to define where to send a message

Posted by ychawla <pr...@yahoo.com>.
Hello,
You can also try using a recipient list and only have a single recipient on
it.  It can function as a dynamic router when you dynamically set a header.

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-header-notation-to-define-where-to-send-a-message-tp5717318p5717343.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using Simple header notation to define where to send a message

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

See the FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html


On Tue, Aug 14, 2012 at 1:52 PM, AlanFoster <al...@alanfoster.me> wrote:
> Hi,
>
> I'm wondering if it's possible to define a header to set up where an
> exchange should be send to, then access it through simple within the "to"
> uri.
>
> For instance I have one route which sets up what service I need to send a
> message to.
> Then the other message sends it to the required service, then does all
> appropriate response handling based on the status code returned.
>
> <route id="routingLogic">
>     <from uri="activemq:etc" />
>
>     <setHeader headerName="serviceAddress">
>         <constant>cxf:bean:example</constant>
>     </setHeader>
>
>     <to uri="direct:sendingLogic" />
> </route>
>
> <route>
>    <from "direct:sendingLogic" />
>
>    <to uri="${headers.serviceAddress}" />
>
>    <setHeader
> headerName="responseCode"><xpath>//foo/bar/responseCode</xpath><setHeader>
>     <choice>
>        ....
>     </choice>
> </route>
>
> I am wondering if it is possible to use anything like this? As I currently
> get the error of
>
> Caused by: org.osgi.service.blueprint.container.NoSuchComponentException: No
> component with id '${headers.serviceAddress}' could be found
>
> Thanks
>
> Alan
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-header-notation-to-define-where-to-send-a-message-tp5717318.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Using Simple header notation to define where to send a message

Posted by AlanFoster <al...@alanfoster.me>.
Ah, I forgot about that option!

Thank you Claus and Yogesh!



--
View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-header-notation-to-define-where-to-send-a-message-tp5717318p5717539.html
Sent from the Camel - Users mailing list archive at Nabble.com.