According to document ( https://camel.apache.org/using-getin-or-getout-methods-on-exchange.html), when we modify body of exchange, we should use exchange.getIn().setBody() instead of exchange.getOut().setBody()
It ususally works. but for OnException block, it does not work , I have to use exchange.getOut().setBody Any hints are more than suggest or hints are more than welcome! onException(Exception.class).convertBodyTo(String.class).log(LoggingLevel.INFO, .process(exchange -> { exchange.getIn().setHeader("Content-Type", "text/xml; charset=UTF-8"); exchange.getOut().setBody(" Error happend , please contact Admin "); //exchange.getIn().setBody(" Error happend , please contact Admin "); -> exchange.getIn().setBody does not work here!!! }).handled(true).end();