Skip to content

Conversation

TomasHofman
Copy link
Contributor

@TomasHofman TomasHofman commented Mar 7, 2019

Microprofile Fault Tolerance guide.

Related quickstart PR: quarkusio/quarkus-quickstarts#79

Copy link
Member

@gsmet gsmet left a 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.
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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`.
Copy link
Member

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.
Copy link
Member

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:
Copy link
Member

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>
Copy link
Member

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"
Copy link
Member

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)
Copy link
Member

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.
Copy link
Member

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

@TomasHofman
Copy link
Contributor Author

@gsmet thanks so much for corrections, I agree with everything. Oy, the articles...

The quickstart project PR is here: quarkusio/quarkus-quickstarts#79

@gsmet gsmet merged commit 8d553cb into quarkusio:master Mar 9, 2019
@stuartwdouglas stuartwdouglas added this to the 0.12.0 milestone Mar 12, 2019
@gsmet gsmet changed the title Add MP Fault Tolerance guide Add MicroProfile Fault Tolerance guide Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants