是否需要RetryOperations?

时间:2018-07-18 13:44:39

标签: spring-retry

使用retry-spring时是否需要RetryOperations? 还是在我的方法上添加注释就足够了?

@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");
 }

0 个答案:

没有答案