So I have a basic method which already has @Retryable annotation. I recently came across "exceptionExpression" to suppress retry based on some condition. I want to know what are some of the ways I can use this exceptionExpression. I have tried message.contains method. But can I use maybe a result from a boolean function to do the same thing?
Asked
Active
Viewed 156 times
1 Answers
0
See the java docs:
/**
* Specify an expression to be evaluated after the
* {@code SimpleRetryPolicy.canRetry()} returns true - can be used to conditionally
* suppress the retry. Only invoked after an exception is thrown. The root object for
* the evaluation is the last {@code Throwable}. Other beans in the context can be
* referenced. For example: <pre class=code>
* {@code "message.contains('you can retry this')"}.
* </pre> and <pre class=code>
* {@code "@someBean.shouldRetry(#root)"}.
* </pre>
* @return the expression.
* @since 1.2
*/

Gary Russell
- 166,535
- 14
- 146
- 179