You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by garrydias <ga...@gmail.com> on 2013/03/04 22:35:08 UTC

Headers are disapearing in RoutePolicy.onExchangeDone

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.

Re: Headers are disapearing in RoutePolicy.onExchangeDone

Posted by garrydias <ga...@gmail.com>.
Ok.. I always forget.. sorry.

I'm using version 2.10.3.

Thanx
Em 05/03/2013 06:16, "Claus Ibsen-2 [via Camel]" <
ml-node+s465427n5728558h38@n5.nabble.com> escreveu:

> Hi
>
> Please always tell us what Camel version you use as we say here
> http://camel.apache.org/support
>
> And have you tried upgrading Camel etc.
>
>
> On Mon, Mar 4, 2013 at 10:35 PM, garrydias <[hidden email]<http://user/SendEmail.jtp?type=node&node=5728558&i=0>>
> 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: [hidden email]<http://user/SendEmail.jtp?type=node&node=5728558&i=1>
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Headers-are-disapearing-in-RoutePolicy-onExchangeDone-tp5728492p5728558.html
>  To unsubscribe from Headers are disapearing in
> RoutePolicy.onExchangeDone, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5728492&code=Z2FycnlkaWFzQGdtYWlsLmNvbXw1NzI4NDkyfC04NTc2NjczMDc=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Headers-are-disapearing-in-RoutePolicy-onExchangeDone-tp5728492p5728567.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Headers are disapearing in RoutePolicy.onExchangeDone

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

Please always tell us what Camel version you use as we say here
http://camel.apache.org/support

And have you tried upgrading Camel etc.


On Mon, Mar 4, 2013 at 10:35 PM, garrydias <ga...@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

Re: Headers are disapearing in RoutePolicy.onExchangeDone

Posted by garrydias <ga...@gmail.com>.
Nothing!

The out attribute is null. HereĀ“s an Eclipse inspection of my exchange
object:
breakpoint_print.jpg
<http://camel.465427.n5.nabble.com/file/n5731632/breakpoint_print.jpg>  

exchange.hasOut() returns false.

BUT... :)

I was using Camel 2.10.2. 

In Camel 2.11.0 this problem seems to be fixed. I updated the camel version
and this problem gone away.

Thanx Claus.



--
View this message in context: http://camel.465427.n5.nabble.com/Headers-are-disapearing-in-RoutePolicy-onExchangeDone-tp5728492p5731632.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Headers are disapearing in RoutePolicy.onExchangeDone

Posted by Claus Ibsen <cl...@gmail.com>.
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 <ga...@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

Re: Headers are disapearing in RoutePolicy.onExchangeDone

Posted by garrydias <ga...@gmail.com>.
Hi, Claus.. sorry for delay.. I had to abandon this project for a while.

I added a step after routingSlip and the problem still remains.

Yes! The destination in #2 is the same as 1#.

Please, see the routes I already had tested:

works1.xml <http://camel.465427.n5.nabble.com/file/n5731567/works1.xml>  
works2.xml <http://camel.465427.n5.nabble.com/file/n5731567/works2.xml>  
does_not_work1.xml
<http://camel.465427.n5.nabble.com/file/n5731567/does_not_work1.xml>  
does_not_work2.xml
<http://camel.465427.n5.nabble.com/file/n5731567/does_not_work2.xml>  
does_not_work3.xml
<http://camel.465427.n5.nabble.com/file/n5731567/does_not_work3.xml>  
does_not_work4.xml
<http://camel.465427.n5.nabble.com/file/n5731567/does_not_work4.xml>  

Thanx



--
View this message in context: http://camel.465427.n5.nabble.com/Headers-are-disapearing-in-RoutePolicy-onExchangeDone-tp5728492p5731567.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Headers are disapearing in RoutePolicy.onExchangeDone

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 4, 2013 at 10:35 PM, garrydias <ga...@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>/
>

Can you try adding a step after routingSlip

... routing slip here
<to uri="log:foo?showHeaders=true"/>
</camel:route>

And is amq_destination_1 the same destination as you use in the #1 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