/** * Do not have Spring AMQP re-try messages upon failure, leave it to Camel * @return An advice chain populated with a NeverRetryPolicy */ public final Advice[] getAdviceChain() { RetryTemplate retryRule = new RetryTemplate(); retryRule.setRetryPolicy(new NeverRetryPolicy()); StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean(); retryOperation.setRetryOperations(retryRule); retryOperation.setMessageKeyGenerator(new DefaultKeyGenerator()); return new Advice[] { retryOperation.getObject() }; }
/** * Do not have Spring AMQP re-try messages upon failure, leave it to Camel * @return An advice chain populated with a NeverRetryPolicy */ public final Advice[] getAdviceChain() { RetryTemplate retryRule = new RetryTemplate(); retryRule.setRetryPolicy(new NeverRetryPolicy()); StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean(); retryOperation.setRetryOperations(retryRule); retryOperation.setMessageKeyGenerator(new DefaultKeyGenerator()); return new Advice[] { retryOperation.getObject() }; }
private Advice createRetryInterceptor(final CountDownLatch latch, boolean stateful) throws Exception { AbstractRetryOperationsInterceptorFactoryBean factory; if (stateful) { factory = new StatefulRetryOperationsInterceptorFactoryBean(); } else { factory = new StatelessRetryOperationsInterceptorFactoryBean(); } factory.setMessageRecoverer((message, cause) -> { logger.warn("Recovered: [" + SerializationUtils.deserialize(message.getBody()).toString() + "], message: " + message); latch.countDown(); }); if (retryTemplate == null) { retryTemplate = new RetryTemplate(); } factory.setRetryOperations(retryTemplate); return factory.getObject(); }
public DefaultRetryPolicyAdvice(MessageRecoverer messageRecoverer, RetryPolicy retryPolicy) { RetryTemplate retryTemplate = new RetryTemplate(); retryTemplate.setBackOffPolicy(createBackOffPolicy()); retryTemplate.setRetryPolicy(retryPolicy); retryTemplate.registerListener(new RetryErrorListener()); StatefulRetryOperationsInterceptorFactoryBean factory = new StatefulRetryOperationsInterceptorFactoryBean(); factory.setRetryOperations(retryTemplate); factory.setMessageKeyGenerator(new DefaultMessageKeyGenerator()); factory.setMessageRecoverer(messageRecoverer); this.delegate = factory.getObject(); }
container.setQueueNames("retry.test.queue"); StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();
public DefaultRetryPolicyAdvice(MessageRecoverer messageRecoverer, RetryPolicy retryPolicy) { RetryTemplate retryTemplate = new RetryTemplate(); retryTemplate.setBackOffPolicy(createBackOffPolicy()); retryTemplate.setRetryPolicy(retryPolicy); retryTemplate.registerListener(new RetryErrorListener()); StatefulRetryOperationsInterceptorFactoryBean factory = new StatefulRetryOperationsInterceptorFactoryBean(); factory.setRetryOperations(retryTemplate); factory.setMessageKeyGenerator(new DefaultMessageKeyGenerator()); factory.setMessageRecoverer(messageRecoverer); this.delegate = factory.getObject(); }
container.setQueueNames("retry.test.queue"); StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();
container.setQueueNames("retry.test.queue"); StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();