camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Headers are disapearing in RoutePolicy.onExchangeDone
Date Fri, 26 Apr 2013 08:25:01 GMT
Hi

In the exchangeDone try with

if (exchange.hasOut()) {
  System.out.println("onExchangeDone - Total headers: " +
exchange.getOut().getHeaders().size());
} else {
  System.out.println("onExchangeDone - Total headers: " +
exchange.getIn().getHeaders().size());
}

On Mon, Mar 4, 2013 at 10:35 PM, garrydias <garrydias@gmail.com> wrote:
> Hi, Friends
>
> #1) consider the route below:
>
> /               <camel:route id="routeContentEntry" routePolicyRef="myRoutePolicy">
>                         <camel:from ref="amqContentEntry" />
>                         <camel:to uri="bean:contentConsumer?method=consume" />
>                         <camel:to ref="legacyDestinationEntry" />
>                 </camel:route>/
>
> when my app runs that route, my RoutePolicy bean perform onExchangeBegin and
> onExchangeDone methods which prints /"onExchangeBegin - Total headers: 30"/
> and /"onExchangeDone - Total headers: 30"/, respectively.
>
>
> #2) Changing my route like that:
>
> /               <camel:route id="routeContentEntry" routePolicyRef="myRoutePolicy">
>                         <camel:from ref="amqContentEntry" />
>                         <camel:to uri="bean:contentConsumer?method=consume" />
>                         *<camel:routingSlip>
>                                 <camel:header>amq_destination_1</camel:header>
>                         </camel:routingSlip>*
>                 </camel:route>/
>
> when my app runs that route, my RoutePolicy bean perform onExchangeBegin and
> onExchangeDone methods which prints /"onExchangeBegin - Total headers: 30"/
> and /*"onExchangeDone - Total headers: 0"*/, respectively.
>
>
> What the route #2 did to my message headers in the onExchangeDone execution?
>
>
> /Method bodies:/
> public void onExchangeBegin(Route route, Exchange exchange)
> {
>         System.out.println("onExchangeBegin - Total headers: " +
> exchange.getIn().getHeaders().size());
> }
>
>
> public void onExchangeDone(Route route, Exchange exchange)
> {
>         System.out.println("onExchangeDone - Total headers: " +
> exchange.getIn().getHeaders().size());
> }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Headers-are-disapearing-in-RoutePolicy-onExchangeDone-tp5728492.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Mime
View raw message