You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2023/03/12 08:16:56 UTC

[GitHub] [camel] davsclaus commented on pull request #9510: Convert expression when setting header / property on message / exchange.

davsclaus commented on PR #9510:
URL: https://github.com/apache/camel/pull/9510#issuecomment-1465121743

   okay but this PR is wrong as the Route DSL uses the mode/expression, and Java API uses the object as-is. So to set a constant value, set it directly.
   
   The setHeader/setProperty are optimized for core use and we should not add overhead with this. Also when you set the value you evaluate it as well this is wrong, as some Camel components allow using an Expression as a header for dynamic computation that they evaluate later.
   
   So the correct solution is to
   
   exchange.getMessage().setHeader("name", "value")
   
   


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org