Reputation: 11915
I am trying to set some headers on a message that is manipulated as it passes through the processors references in my camel DSL. The very first thing I have, however, is a processor for .onCompletion, which is supposed to read the message from the exchange, get the headers and log them.
Does that have to come last in my DSL? It appears that my finaly .process() processor can see all of the new header values I added through the rest of the code, but when I go to log them all at .onCompletion, the values for those headers is null. it's almost like it has a stale version of the message or exchange or something. Why else would this be happening?
Upvotes: 1
Views: 710
Reputation: 55555
Yes you should configure things like
In the start of your route. However the DSL is Camel 2.x is very open, and thus you can in some places configure this elsewhere (eg not in the start). But the rule of thumb is to do this first. And then after that, you regular route.
Side note: Mind that Camel also allows you to configure these kind on global level (aka context scope) instead of route. Eg you can have a context scoped error handler. And then only in a special route override and have a route special error handler.
In Camel 3.0 onwards we will make the DSL more strict, so we enforce configuration in the start. This also reduces the number of methods you would see in the code assistance list (eg pressing ctrl + space) in the regular routes. As those configurations would then no longer be listed.
The reason why they show up, is that they inheirt the same base class which is the corner stone in the DSL. And we don't wanna break this in the current 2.x line as then some people may get affected.
Upvotes: 3
Reputation: 21015
the order shouldn't matter...it should be using a copy of the Exchange when the route has completed regardless...post your route and we can perhaps help more
Upvotes: 0