-
Notifications
You must be signed in to change notification settings - Fork 3k
Add MicroProfile Fault Tolerance guide #1318
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work Tomas.
I added some comments, mostly very minor things.
Could you wrap that into a quickstart project (against the development
branch of the quickstarts)?
|
||
== Adding Resiliency: Timeouts | ||
|
||
So what else have we've got in MicroProfile Fault Tolerance? Let's look into timeouts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/have we've got/have we got/
``` | ||
|
||
You can see that every time an invocation fails, it's immediately followed by another invocation, until one succeeds. | ||
Since we allowed 4 retries, it would require 5 invocations to fail in row, in order for the user to be actually exposed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/in row/in a row/ ?
Note that the timeout was configured to 250 ms, and a random artificial delay between 0 to 500 ms was introduced | ||
into the `CoffeeResource#recommendations()` method. | ||
|
||
In your browser, go to `http://localhost:8080/coffee/2/recommendations` and hit refresh couple of times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of times?
|
||
In your browser, go to `http://localhost:8080/coffee/2/recommendations` and hit refresh couple of times. | ||
|
||
You should see some requests timeout with `org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be time out
the verb here?
In your browser, go to `http://localhost:8080/coffee/2/recommendations` and hit refresh couple of times. | ||
|
||
You should see some requests timeout with `org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException`. | ||
Requests that do not timeout should show two recommended coffee samples in JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
|
||
`mvn quarkus:add-extension -Dextensions="smallrye-fault-tolerance"` | ||
|
||
* or simply adding following Maven dependency: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the following
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-smallrye-fault-tolerance-deployment</artifactId> | ||
<version>${quarkus.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 things: you need to drop the -deployment
suffix now (it's a last minute change we made to Quarkus) and you can drop the version, people should use the BOM.
-DprojectArtifactId=microprofile-fault-tolerance \ | ||
-DclassName="org.acme.faulttolerance.CoffeeResource" \ | ||
-Dpath="/coffee" \ | ||
-Dextensions="smallrye-fault-tolerance, resteasy-jsonb, arc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to add arc
-Dextensions="smallrye-fault-tolerance, resteasy-jsonb, arc" | ||
---- | ||
|
||
This command generates a Maven structure importing the extensions for RESTEasy/JAX-RS, Dependency Injection (Arc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can drop ArC here
---- | ||
|
||
This command generates a Maven structure importing the extensions for RESTEasy/JAX-RS, Dependency Injection (Arc) | ||
and Smallrye Fault Tolerance, which is an implementation of MicroProfile Fault Tolerance spec that Quarkus uses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of the MicroProfile Fault Tolerance spec
0280bc5
to
d7a6d89
Compare
@gsmet thanks so much for corrections, I agree with everything. Oy, the articles... The quickstart project PR is here: quarkusio/quarkus-quickstarts#79 |
Microprofile Fault Tolerance guide.
Related quickstart PR: quarkusio/quarkus-quickstarts#79