File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
transactionoutbox-core/src/main/java/com/gruelbox/transactionoutbox Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .time .Duration ;
4
4
5
+ /**
6
+ * Defines a custom retry policy for tasks scheduled in the {@link TransactionOutbox}.
7
+ * <p>
8
+ * Implement this interface in the class that is passed to
9
+ * {@link TransactionOutbox#schedule(Class)} to override the default retry behavior.
10
+ * </p>
11
+ */
5
12
public interface RetryPolicyAware {
13
+ /**
14
+ * Determines the wait duration before retrying a failed task.
15
+ *
16
+ * @param attempt The current retry attempt (starting from 1).
17
+ * @param throwable The exception that caused the failure.
18
+ * @return The duration to wait before the next retry.
19
+ */
6
20
Duration waitDuration (int attempt , Throwable throwable );
7
21
22
+ /**
23
+ * Specifies the maximum number of retry attempts before blocking the task.
24
+ *
25
+ * @param attempt The current retry attempt (starting from 1).
26
+ * @param throwable The exception that caused the failure.
27
+ * @return The number of attempts after which the task should be blocked.
28
+ * If the returned value is less than or equal to {@code attempt}, the task is blocked immediately.
29
+ */
8
30
int blockAfterAttempts (int attempt , Throwable throwable );
9
31
}
You can’t perform that action at this time.
0 commit comments