java-design-patterns
java-design-patterns copied to clipboard
Asynchronous Retry pattern
Description:
The Asynchronous Retry design pattern is aimed at handling transient failures in a reliable and efficient manner. This pattern allows an application to retry an operation asynchronously, ensuring that the application does not block waiting for an operation to complete. This is particularly useful in distributed systems where transient faults are common.
Main Elements of the Pattern:
- Retry Logic: Define a retry mechanism that can handle transient failures. This should include a backoff strategy to prevent overwhelming the system.
- Asynchronous Execution: Implement the retry logic in a way that allows the application to continue executing other tasks while waiting for the retries to complete.
- Callback Mechanism: Provide a way to notify the application when the operation either succeeds or exhausts all retry attempts.
- Configuration: Allow configuration of retry parameters such as the number of attempts, delay between retries, and the backoff strategy.
- Error Handling: Implement proper error handling to manage the final outcome if all retry attempts fail.
References:
Acceptance Criteria:
- Implement a robust and configurable asynchronous retry mechanism with support for various backoff strategies.
- Ensure that the application can continue executing other tasks while the retry mechanism is in progress.
- Provide a callback mechanism to handle the success or failure of the retried operation, including proper error handling for failed attempts.
Hi @iluwatar , what else is expected of this pattern aside from not blocking and returning a Future?
I guess we need a service that sometimes fails to demonstrate the retry. Then a great theme for the example...
Can i pick this up?
Ok @nikhilbarar
This task is free
I'd like to work on this pattern.
Go ahead @krisz7118
@krisz7118 are you working on this?
This issue is free to be taken again!