Hi all,

I'd like to know if there's a way to change the body type without affecting
the original one.

I need to create an interceptor that retrieves the body from an exchange,
convert it to string, log, and forward the original exchange to the next
processor. But, even if I make a copy of my original exchange it doesn't
prevent it from also change the original one.

Here follows what I have to do:

Exchange newExchange = exchange.copy();
String payload = newExchange.getIn().getBody(String.class);
log.info("{}", payload);

target.process(exchange);

newExchange = exchange.copy();
String payload = newExchange.getIn().getBody(String.class);
log.info("{}", payload);

So, when I call the target.process(exchange) the exchange gets changed to
String.

Do you know how I can do it without affecting the original body?

Thanks in advance,


-- 
Marcelo Ohashi

Reply via email to