You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by heinrichheine <ma...@vitaphone.de> on 2011/09/02 12:13:53 UTC

Set response by a second route through "direct" routing?

Hi,
to make my route nicer i created a splitter in my incoming http route.
Depending of the content i route the request to different routes via direct.
The thing is, that i have to create the response for the http-request in my
first route. But i want to create a response from within my directed routes.
Is this possible?

Example

from("jetty://http://127.0.0.1:1234/")
 .choice()
  .when().xpath(expression1)
      .to("direct:goodRoute")
  .when().xpath("expression2)
      .to("direct:badRoute");

So, i want to create the response for the http request in goodRoute and
badRoute. But in real life, the response is just empty if i do so. Do i have
to add an option to the direct route?

Thanks
 martin

--
View this message in context: http://camel.465427.n5.nabble.com/Set-response-by-a-second-route-through-direct-routing-tp4761827p4761827.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Set response by a second route through "direct" routing?

Posted by Willem Jiang <wi...@gmail.com>.
How did you set the response in your directed routes?
I didn't find it.

On 9/2/11 6:13 PM, heinrichheine wrote:
> Hi,
> to make my route nicer i created a splitter in my incoming http route.
> Depending of the content i route the request to different routes via direct.
> The thing is, that i have to create the response for the http-request in my
> first route. But i want to create a response from within my directed routes.
> Is this possible?
>
> Example
>
> from("jetty://http://127.0.0.1:1234/")
>   .choice()
>    .when().xpath(expression1)
>        .to("direct:goodRoute")
>    .when().xpath("expression2)
>        .to("direct:badRoute");
>
> So, i want to create the response for the http request in goodRoute and
> badRoute. But in real life, the response is just empty if i do so. Do i have
> to add an option to the direct route?
>
> Thanks
>   martin
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Set-response-by-a-second-route-through-direct-routing-tp4761827p4761827.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Set response by a second route through "direct" routing?

Posted by heinrichheine <ma...@vitaphone.de>.
Yes, it works. I had a mistake at a different point.
Thanks!

--
View this message in context: http://camel.465427.n5.nabble.com/Set-response-by-a-second-route-through-direct-routing-tp4761827p4782573.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Set response by a second route through "direct" routing?

Posted by boday <be...@initekconsulting.com>.
Martin, this should work...just make sure you are setting the OUT message on
the exchange (exchange.getOut().setBody("RESPONSE"), etc)...


heinrichheine wrote:
> 
> Hi,
> to make my route nicer i created a splitter in my incoming http route.
> Depending of the content i route the request to different routes via
> direct.
> The thing is, that i have to create the response for the http-request in
> my first route. But i want to create a response from within my directed
> routes. Is this possible?
> 
> Example
> 
> from("jetty://http://127.0.0.1:1234/")
>  .choice()
>   .when().xpath(expression1)
>       .to("direct:goodRoute")
>   .when().xpath("expression2)
>       .to("direct:badRoute");
> 
> So, i want to create the response for the http request in goodRoute and
> badRoute. But in real life, the response is just empty if i do so. Do i
> have to add an option to the direct route?
> 
> Thanks
>  martin
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Set-response-by-a-second-route-through-direct-routing-tp4761827p4763955.html
Sent from the Camel - Users mailing list archive at Nabble.com.