Apache Camel – Message History

Message history in Apache Camel is available since camel 2.12. Message history of a message will help to trace out the list of all applications that the message passed through since its origination. When a message is sent to an endpoint, that endpoint information is stored in message history.Message history is stored as exchange property.

MessageHistory for an endpoint will contains route id, processor id, timestamp, and elapsed time.

Enabling or disabling message history:

We can enable or disabled per Message History on a CamelContext or a Camel  route.

For example, you can turn off it from camel context as :

context.setMessageHistory(false);

If enabled, Camel will by default display the history information in log along with exception stacktrace. This will help us in debugging the issues.

If not required, we can turn off logging the history from exception handler by using:

myErrorHandler(defaultErrorHandler().logExhaustedMessageHistory(false));

Since Camel 2.17, logging message history is turned off by default and we have to enable this manually if required.

myErrorHandler(defaultErrorHandler().logExhaustedMessageBody(true));

 

Leave a Reply

Your email address will not be published. Required fields are marked *