\r
import org.springframework.boot.SpringApplication;\r
import org.springframework.boot.autoconfigure.SpringBootApplication;\r
+import org.springframework.retry.annotation.EnableRetry;\r
\r
+@EnableRetry\r
@SpringBootApplication\r
public class Application {\r
\r
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
+import org.springframework.retry.support.RetrySynchronizationManager;
import org.springframework.stereotype.Component;
@Slf4j
convertToDuplicatedYangResourceException(
dataIntegrityViolationException, newYangResourceEntities);
convertedException.ifPresent(
- e -> log.warn(
- "Cannot persist duplicated yang resource. "
- + "System will attempt this method up to 5 times.", e));
+ e -> {
+ int retryCount = RetrySynchronizationManager.getContext() == null ? 0
+ : RetrySynchronizationManager.getContext().getRetryCount();
+ log.warn("Cannot persist duplicated yang resource. System will attempt this method "
+ + "up to 5 times. Current retry count : {}", ++retryCount, e);
+ });
throw convertedException.isPresent() ? convertedException.get() : dataIntegrityViolationException;
}
}