This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Retryable() | |
fun doWithRetry(input : String) { | |
// do something | |
} | |
@Recover | |
fun recover(exception: RuntimeException, input : String) : Unit { | |
// do someThing | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface RetryListener { | |
<T, E extends Throwable> boolean open(RetryContext context, RetryCallback<T, E> callback); | |
<T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback, Throwable throwable); | |
<T, E extends Throwable> void onError(RetryContext context, RetryCallback<T, E> callback, Throwable throwable); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Retryable(backoff = Backoff(2000)) | |
fun doWithRetry() { | |
// do something | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Retryable(include = [RuntimeException::class, IllegalStateException::class]) | |
fun doWithRetry() { | |
// do something | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class RetryableService { | |
@Autowired | |
private lateinit var retryTemplate: RetryTemplate | |
@Retryable | |
fun doWithRetry() : Unit { | |
randomFail() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
@EnableRetry | |
class RetryTestApplication | |
fun main(args: Array<String>) { | |
// main function | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation("org.springframework.retry:spring-retry") | |
implementation("org.springframework:spring-aspects") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class RetryableService { | |
@Retryable | |
fun run() : Unit { | |
action() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class RetryableService { | |
@Autowired | |
private lateinit var retryTemplate: RetryTemplate | |
fun run() : Unit { | |
retryTemplate.execute<Unit, Throwable> { | |
action() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class RetryableService { | |
@Autowired | |
private lateinit var retryTemplate: RetryTemplate | |
fun run() : Unit { | |
retryTemplate.execute<Unit, Throwable> { | |
action() | |
} |
NewerOlder