question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Using circuit breaker and retry together

See original GitHub issue

Resilience4j version: v1.4.0

Java version: 11

Hey team, I had a few questions regarding the use of CB and retry together:

  1. Is there any documentation out there for how to get that set up? I’m confused as to how the retry fallbacks and circuit breaker fallbacks and state transitions work together.
  2. My use case is to send some data to a Kafka cluster through a decorated Consumer and I’m using the decorateConsumer method from a CircuitBreaker but to execute it I don’t see any methods. Currently I’m just calling the accept method from a Consumer interface, is there any other way to run a decorated Consumer?
  3. If I want to decorate a Consumer with both CircuitBreaker and Retry is there any way to do so without using the decorators dependency? I’m thinking of having just the r4j-circuitbreaker and r4j-retry dependencies and decorate the Consumer with one and save it in a variable and then decorate the new saved variable with the other. Thoughts on this?

EDIT:

  1. For custom configuration for either decorators, if I use a custom config and only set a few of the options available, what happens for the other ones. For example if I use CircuitBreakerConfig object and build a custom config that only defines a failure threshold in half open state and closed state, what happens to all the other configuration properties that can be set such as number of calls permitted in half-open state, etc. Does it still use the default values for all the other properties and only overrides the ones I’ve set in the custom config object that is passed to the CircuitBreakerRegistry or CircuitBreaker directly?
  2. Is there any retry functionality built into CircuitBreaker where if an error occurs then it stores the data that was supposed to be sent and then re-sent it. And if Retry is supposed to be used for that purpose, does Retry have a buffer where it stores the data that should’ve been sent and that it needs to retry sending? Or does the Retry functionality work on each call of a Consumer/Supplier/etc. at a time so it doesn’t care if 100 calls fail in a second because it’ll retry it with whatever logic is set up for each of those 100 calls separately in the same or new thread(s)?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
deepankarmalhancommented, Jun 2, 2020

Will do, thanks!

EDIT: Submitted.

1reaction
RobWincommented, Jun 2, 2020

You can suggest edits. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to combine Retryable and CircuitBreaker together in ...
When Retry from Circuit Breaker is implemented, circuit breaker will see errors only after retries are complete. In this approach, thresholds ...
Read more >
Circuit Breaker and Retry - Dan Tran - Medium
Circuit breaker is commonly used in stateless online transaction systems, especially at the integration points. Retry should use for scheduling ...
Read more >
Retry vs Circuit Breaker - DEV Community ‍ ‍
The purpose of the Circuit Breaker pattern is different than the Retry pattern. The Retry pattern enables an application to retry an operation ......
Read more >
Designing Resilient Systems: Circuit Breakers or Retries ...
This post is the second part of the series on Designing Resilient Systems. In Part 1, we looked at use cases for implementing...
Read more >
Circuit Breaker pattern - Azure Architecture Center
An application can combine these two patterns by using the Retry pattern to invoke an operation through a circuit breaker. However, the retry...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found