Forum Home » Fuse Distributions » Fuse Mediation Router

Thread: Message headers between routs

 
This question is answered.


Permlink Replies: 4 - Last Post: Aug 17, 2012 8:31 PM Last Post By: gmdavidson62
gmdavidson62

Posts: 34
Registered: 11/25/09
Message headers between routs
Posted: Aug 9, 2012 9:03 PM
 
  Click to reply to this thread Reply
I am trying to figure out the best place to store data during a route. Should it be on the exchange as a property or on the in/out message?

Currently we are storing information
-in time to the route
-message size in to the route
Then at the end of the route we log this information along with the out time and size.

An issue comes up when we call another route, which overwrites these headers, as we are using the same technique and naming in other routes.

So the question, is there a "scope" to these headers we can use, or should we be using the exchange properties, or do I have to manually pull of the headers on the inbound, then replace on the way out?

Thanks!
njiang

Posts: 572
Registered: 09/17/07
Re: Message headers between routs
Posted: Aug 10, 2012 2:32 AM   in response to: gmdavidson62 in response to: gmdavidson62
 
  Click to reply to this thread Reply
The exchange property will be copied by default, but camel processor can overwrite the message header at any minutes. If you want to store something in the exchange scope time, you need to store it into the exchange property.

Willem
gmdavidson62

Posts: 34
Registered: 11/25/09
Re: Message headers between routs
Posted: Aug 10, 2012 2:41 PM   in response to: njiang in response to: njiang
 
  Click to reply to this thread Reply
Thank you, that is what I thought.

So just to confirm, if I set a message header or exchange property in route 1, then inside that route 1 call route 2, and route 2 changes the value of the header/property....when it comes back to route 1, the value will be what route 2 set it to be.

Psuedo code:

<route 1>
<setheader "a">route 1 header</setheader>
<to: route 2>
<!-- contents of header = 'route 2 header' -->
<route 1>

<route 2>
<setheader "a">route 2 header</setheader>
</route 2>
njiang

Posts: 572
Registered: 09/17/07
Re: Message headers between routs
Posted: Aug 13, 2012 12:48 AM   in response to: gmdavidson62 in response to: gmdavidson62
Correct
  Click to reply to this thread Reply
It depends how the out message is set in your route2. In most case the out message is just copying the header of in message, so you should get "route 2 header" in this case.

Willem
gmdavidson62

Posts: 34
Registered: 11/25/09
Re: Message headers between routs
Posted: Aug 17, 2012 8:31 PM   in response to: njiang in response to: njiang
 
  Click to reply to this thread Reply
Thank you, makes sens