java-design-patterns icon indicating copy to clipboard operation
java-design-patterns copied to clipboard

Asynchronous Retry pattern

Open iluwatar opened this issue 9 years ago • 10 comments

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:

  1. Retry Logic: Define a retry mechanism that can handle transient failures. This should include a backoff strategy to prevent overwhelming the system.
  2. 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.
  3. Callback Mechanism: Provide a way to notify the application when the operation either succeeds or exhausts all retry attempts.
  4. Configuration: Allow configuration of retry parameters such as the number of attempts, delay between retries, and the backoff strategy.
  5. Error Handling: Implement proper error handling to manage the final outcome if all retry attempts fail.

References:

Acceptance Criteria:

  1. Implement a robust and configurable asynchronous retry mechanism with support for various backoff strategies.
  2. Ensure that the application can continue executing other tasks while the retry mechanism is in progress.
  3. Provide a callback mechanism to handle the success or failure of the retried operation, including proper error handling for failed attempts.

iluwatar avatar Jul 13 '16 15:07 iluwatar

Hi @iluwatar , what else is expected of this pattern aside from not blocking and returning a Future?

llorllale avatar Sep 11 '17 21:09 llorllale

I guess we need a service that sometimes fails to demonstrate the retry. Then a great theme for the example...

iluwatar avatar Sep 12 '17 04:09 iluwatar

Can i pick this up?

nikhilbarar avatar Jun 17 '18 07:06 nikhilbarar

Ok @nikhilbarar

iluwatar avatar Jul 07 '18 05:07 iluwatar

This task is free

iluwatar avatar Oct 05 '19 15:10 iluwatar

I'd like to work on this pattern.

ghost avatar Mar 12 '20 17:03 ghost

Go ahead @krisz7118

iluwatar avatar Mar 25 '20 19:03 iluwatar

@krisz7118 are you working on this?

iluwatar avatar Jul 06 '20 16:07 iluwatar

This issue is free to be taken again!

ohbus avatar Oct 08 '21 13:10 ohbus