Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2017 15:01
Show Gist options
  • Save anonymous/195f2b6c835db82decf1649969a717fe to your computer and use it in GitHub Desktop.
Save anonymous/195f2b6c835db82decf1649969a717fe to your computer and use it in GitHub Desktop.
Camel: How to break polling on pollEnrich() when an error is thrown from poll() method
public boolean rollback(Consumer consumer, Endpoint endpoint,
int retryCounter, Exception e)
throws Exception
{
if (retryCounter < 3) {
Thread.sleep(500);
return true;
}
Exchange ex = endpoint.createExchange();
ex.getIn().setBody(null);
((DefaultConsumer) consumer).getProcessor().process(ex);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment