Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in guide's code #14

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.adoc
Expand Up @@ -159,6 +159,14 @@ $ curl --dump-header - --header 'Host: www.circuitbreaker.com' http://localhost:

NOTE: We use `--dump-header` to see the response headers. The `-` after `--dump-header`
tells cURL to print the headers to stdout.
NOTE: In some cases, you'd get an error saying that ReactiveResilience4JCircuitBreakerFactory not found. A workaround is to add this bean to your code:
----
@Bean
public ReactiveResilience4JCircuitBreakerFactory factory()
{
return new ReactiveResilience4JCircuitBreakerFactory();
}
----

After using this command, you should see the following in your terminal:

Expand All @@ -167,6 +175,15 @@ After using this command, you should see the following in your terminal:
HTTP/1.1 504 Gateway Timeout
content-length: 0
----
NOTE: You can also get an Error saying:
----
socket hang up
----
, and sometimes:
----
curl: (52) Empty reply from server
----
where the server effectively closes connection immediately

As you can see the circuit breaker timed out while waiting for the response from HTTPBin. When the circuit breaker times out,
we can optionally provide a fallback so that clients do not receive a `504` but something
Expand All @@ -187,7 +204,7 @@ public RouteLocator myRoutes(RouteLocatorBuilder builder) {
.uri("http://httpbin.org:80"))
.route(p -> p
.host("*.circuitbreaker.com")
.filters(f -> f.circuitbreaker(config -> config
.filters(f -> f.circuitBreaker(config -> config
.setName("mycmd")
.setFallbackUri("forward:/fallback")))
.uri("http://httpbin.org:80"))
Expand Down