2.14. Performance and Optimization

Avoid unnecessary message copying

You can avoid making an unnecessary copy of the original message, by setting the allowUseOriginalMessage option to false on the CamelContext object. For example, in Blueprint XML you can set this option as follows:
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
              allowUseOriginalMessage="false">
  ...
</camelContext>
You can safely set allowUseOriginalMessage to false, if the following conditions are satisfied:
  • You do not set useOriginalMessage=true on any of the error handlers or on the onException element.
  • You do not use the getOriginalMessage method anywhere in your Java application code.