Created
May 27, 2017 18:50
-
-
Save mzimecki/e46b0c70b167925486569445f69e1512 to your computer and use it in GitHub Desktop.
Redelivery processor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RedeliveryProcessor implements Processor { | |
private static final int MAX_REDELIVERIES = 5; | |
@Override | |
public void process(Exchange exchange) throws Exception { | |
final int redeliveryCount = exchange.getIn().getHeader(ServiceConstants.REDELIVERY_COUNT_HEADER_NAME, Integer.class).intValue(); | |
if (redeliveryCount <= MAX_REDELIVERIES) { | |
exchange.getIn().setHeader(ServiceConstants.REDELIVERY_COUNT_HEADER_NAME, redeliveryCount + 1); | |
} else { | |
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment