squakez commented on PR #22677:
URL: https://github.com/apache/camel/pull/22677#issuecomment-4286613951

   Good point about the processor, and I've verified this would be compatible. 
I think it can be even simplified using the `setHeader` which is more 
idiomatic. So, the route would be like:
   
   ```
                           .setHeader("BAGGAGE_XYZ", constant("Hello World"))
                           .routeId("start")
                           .log("A message")
                           .process(new Processor() {
                               @Override
                               public void process(Exchange exchange) throws 
Exception {
                                   exchange.getIn().setHeader("operation", 
"fake");
                               }
                           })
                           .to("log:info");
   ```
   Resulting in:
   ```
   ********** Span (start) baggage {}
   ********** Span (start) baggage {camelScope=ImmutableEntry{value=true, 
metadata=ImmutableEntryMetadata{value=}}}
   ********** Span (log) baggage {XYZ=ImmutableEntry{value=Hello World, 
metadata=ImmutableEntryMetadata{value=}}, camelScope=ImmutableEntry{value=true, 
metadata=ImmutableEntryMetadata{value=}}}
   ```
   I'm going to prepare a PR to introduce it, unless you see any possible 
drawback. Thanks for the time and the help to reason about this new feature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to