首页 > 解决方案 > 需要 RetryOperations 吗?

问题描述

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

标签: spring-retry

解决方案


推荐阅读