0

Does RetryOperations required when I use retry-spring ? or is it enough to have the annotation over my method?

@Retryable(value = {SQLException.class, Exception.class,RuntimeException.class, RetryException.class, ExhaustedRetryException.class}, //retry will be attempted only if the method throws an SQLException.
        maxAttempts = 3, backoff = @Backoff (5000))
public boolean sendJmsMessage(final String xml) {
jmsTemplate.send.........()
// logic to send jms

}


@Recover
  public void ExhaustedRetryException(ExhaustedRetryException re) {
    LOG.error("Failed to deliver the message using the retry");
 }
Samarland
  • 561
  • 1
  • 10
  • 23
  • 1
    `@Retryable` should be enough. But where is the method you wanna retry? Or what is the real problem you faced? – Jorj Jul 18 '18 at 13:51
  • I just did some , sorry – Samarland Jul 18 '18 at 13:52
  • It's sending jms message in active mq – Samarland Jul 18 '18 at 13:52
  • what's the use of RetryOperations cases? – Samarland Jul 18 '18 at 13:55
  • I think you have a XY problem. See https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem – Jorj Jul 18 '18 at 13:55
  • in your example, the retry mechanism should work, without `RetryOperations`. If it's not working maybe you have a configuration problem. Do you have a class annotated with `@Configuration` and `@EnableRetry`, something like `@Configuration @EnableRetry public class AppConfig { ... }`? – Jorj Jul 18 '18 at 14:05
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/176255/discussion-between-jorj-and-samarland). – Jorj Jul 18 '18 at 14:08
  • I was asking about the RetryOperations is required or not : ) so I think I got the answer , Thanks! – Samarland Jul 18 '18 at 14:35

0 Answers0