Question about use of "in" and "out" messages in exchange
I'm working on a custom processor that is supposed to take a message in, convert it, and send the results out. The problem I'm running into is that unless I do things a specific way, it looks like the headers on the source message get dropped. For example, to create an outbound message, I have to do this:
String input = ...(modified text)
Is there something I'm missing here that's obvious, specifically a way to simplify this? I think I may be doing unnecessary work in copying the headers, and that there may be an easier way. SHould I just work with the "in" message and modify it, or am I correct in working with the "out" message, assuming that the "in" is immutable? In my case, it's very important that I retain the original message's headers.
I've also noticed that some of the camel components, specifically the velocity one, have a tendency to drop headers. For example, if I try to wire a velocity processor into a chain that leads to an eventual output file, my filename header gets dropped if it's added earlier in the chain.