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?
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.
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.