Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

cannot exchange mesasge body during a retryWhile()

$
0
0
Hi all,

I've got a scenario where given an exception on a route, I want to retry the sub-route but with a modified body (String.class type).
from("direct:foo")
.onException(SomeException.class)
.handled(true)
.retryWhile(new Predicate() {
@Override
public boolean matches(Exchange exchange) {
if (canContinue()) {
exchange.getIn().setBody("newly modified string");
return true;

else {
return false;

}).end()
.to("direct:bar");

The retries are being done correctly and exhausted at the right time - however every retry always has the original body, and not the modified string body I was expecting. Am I not able to modify the exchange body on retry?

Many Thanks,
Elvio

Viewing all articles
Browse latest Browse all 5648

Trending Articles