iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
89.59k stars 26.49k forks source link

Asynchronous Retry pattern #460

Open iluwatar opened 8 years ago

iluwatar commented 8 years ago

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.
llorllale commented 7 years ago

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

iluwatar commented 7 years ago

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

nikhilbarar commented 6 years ago

Can i pick this up?

iluwatar commented 6 years ago

Ok @nikhilbarar

iluwatar commented 5 years ago

This task is free

ghost commented 4 years ago

I'd like to work on this pattern.

iluwatar commented 4 years ago

Go ahead @krisz7118

iluwatar commented 4 years ago

@krisz7118 are you working on this?

ohbus commented 3 years ago

This issue is free to be taken again!