Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ quarkus.container-image.name=tutorial-app
quarkus.container-image.tag=1.0-SNAPSHOT
quarkus.kubernetes.service-type=load-balancer

quarkus.rest-client."com.redhat.developers.SwapiService".url=https://swapii.dev
quarkus.rest-client."com.redhat.developers.SwapiService".url=https://swapii.build
quarkus.rest-client.logging.scope=request-response
quarkus.rest-client.logging.body-limit=1024
quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG
Expand Down
84 changes: 42 additions & 42 deletions documentation/modules/ROOT/pages/08_rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A typical scenario in a Microservices architecture is the remote invocation of remote REST HTTP endpoints. Quarkus provides a typed REST client that follows the https://github.com/eclipse/microprofile-rest-client[MicroProfile REST Client, window=_blank] specification.

Let's create a REST client that accesses https://swapi.info[window=_blank] to get additional information about Movies. The endpoint we're interested in is this one:
Let's create a REST client that accesses https://swapi.build[window=_blank] to get additional information about Movies. The endpoint we're interested in is this one:

* `api/films/\{id\}`, which returns specific info about the given movie.

Expand All @@ -17,56 +17,56 @@ Let's create a REST client that accesses https://swapi.info[window=_blank] to ge
"producer": "Gary Kurtz, Rick McCallum",
"release_date": "1977-05-25",
"characters": [
"https://swapi.info/api/people/1",
"https://swapi.info/api/people/2",
"https://swapi.info/api/people/3",
"https://swapi.info/api/people/4",
"https://swapi.info/api/people/5",
"https://swapi.info/api/people/6",
"https://swapi.info/api/people/7",
"https://swapi.info/api/people/8",
"https://swapi.info/api/people/9",
"https://swapi.info/api/people/10",
"https://swapi.info/api/people/12",
"https://swapi.info/api/people/13",
"https://swapi.info/api/people/14",
"https://swapi.info/api/people/15",
"https://swapi.info/api/people/16",
"https://swapi.info/api/people/18",
"https://swapi.info/api/people/19",
"https://swapi.info/api/people/81"
"https://swapi.build/api/people/1",
"https://swapi.build/api/people/2",
"https://swapi.build/api/people/3",
"https://swapi.build/api/people/4",
"https://swapi.build/api/people/5",
"https://swapi.build/api/people/6",
"https://swapi.build/api/people/7",
"https://swapi.build/api/people/8",
"https://swapi.build/api/people/9",
"https://swapi.build/api/people/10",
"https://swapi.build/api/people/12",
"https://swapi.build/api/people/13",
"https://swapi.build/api/people/14",
"https://swapi.build/api/people/15",
"https://swapi.build/api/people/16",
"https://swapi.build/api/people/18",
"https://swapi.build/api/people/19",
"https://swapi.build/api/people/81"
],
"planets": [
"https://swapi.info/api/planets/1",
"https://swapi.info/api/planets/2",
"https://swapi.info/api/planets/3"
"https://swapi.build/api/planets/1",
"https://swapi.build/api/planets/2",
"https://swapi.build/api/planets/3"
],
"starships": [
"https://swapi.info/api/starships/2",
"https://swapi.info/api/starships/3",
"https://swapi.info/api/starships/5",
"https://swapi.info/api/starships/9",
"https://swapi.info/api/starships/10",
"https://swapi.info/api/starships/11",
"https://swapi.info/api/starships/12",
"https://swapi.info/api/starships/13"
"https://swapi.build/api/starships/2",
"https://swapi.build/api/starships/3",
"https://swapi.build/api/starships/5",
"https://swapi.build/api/starships/9",
"https://swapi.build/api/starships/10",
"https://swapi.build/api/starships/11",
"https://swapi.build/api/starships/12",
"https://swapi.build/api/starships/13"
],
"vehicles": [
"https://swapi.info/api/vehicles/4",
"https://swapi.info/api/vehicles/6",
"https://swapi.info/api/vehicles/7",
"https://swapi.info/api/vehicles/8"
"https://swapi.build/api/vehicles/4",
"https://swapi.build/api/vehicles/6",
"https://swapi.build/api/vehicles/7",
"https://swapi.build/api/vehicles/8"
],
"species": [
"https://swapi.info/api/species/1",
"https://swapi.info/api/species/2",
"https://swapi.info/api/species/3",
"https://swapi.info/api/species/4",
"https://swapi.info/api/species/5"
"https://swapi.build/api/species/1",
"https://swapi.build/api/species/2",
"https://swapi.build/api/species/3",
"https://swapi.build/api/species/4",
"https://swapi.build/api/species/5"
],
"created": "2014-12-10T14:23:31.880000Z",
"edited": "2014-12-20T19:49:45.256000Z",
"url": "https://swapi.info/api/films/1"
"url": "https://swapi.build/api/films/1"
}
----

Expand Down Expand Up @@ -121,7 +121,7 @@ Notice in the logs how Quarkus is reloading and the `rest-client-jackson` extens

== Create Swapi POJO

We need to create a POJO object that is used to unmarshal a JSON message from http://swapi.dev[window=_blank].
We need to create a POJO object that is used to unmarshal a JSON message from https://swapi.build[window=_blank].

Create a new `Swapi` Java class in `src/main/java` in the `com.redhat.developers` package with the following contents:

Expand Down Expand Up @@ -231,7 +231,7 @@ Add the following properties to your `application.properties` in `src/main/resou
[.console-input]
[source,properties]
----
quarkus.rest-client."com.redhat.developers.SwapiService".url=https://swapi.info/api
quarkus.rest-client."com.redhat.developers.SwapiService".url=https://swapi.build/api
----

== Create MovieDTO
Expand Down
6 changes: 3 additions & 3 deletions documentation/modules/ROOT/pages/09_fault-tolerance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ curl -w '\n' localhost:8080/movie?year=1980
]
----

No change from calls done previously, but now change the https://swapi.dev url in your application properties to https://swapii.dev (or some other random url that won't resolve).
No change from calls done previously, but now change the https://swapi.build url in your application properties to https://swapii.build (or some other random url that won't resolve).

Run the following command again:

Expand All @@ -101,7 +101,7 @@ Run the following command again:
curl -w '\n' localhost:8080/movie?year=1980
----

Now after waiting 6 seconds (3 retries x 2 seconds), the next exception is thrown `java.net.UnknownHostException: swapii.dev`.
Now after waiting 6 seconds (3 retries x 2 seconds), the next exception is thrown `java.net.UnknownHostException: swapii.build`.

== Add Fallback to Swapi Service

Expand Down Expand Up @@ -228,7 +228,7 @@ Run the following command at least 5 times (without network connectivity):
curl -w '\n' localhost:8080/movie?year=1980
----

The output changes from `java.net.UnknownHostException: swapii.dev` (or any other network exception) in the first calls to `org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException: getMovieByTitle` when the circuit is opened.
The output changes from `java.net.UnknownHostException: swapii.build` (or any other network exception) in the first calls to `org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException: getMovieByTitle` when the circuit is opened.

The big difference between the first exception and the second one is that the first one occurs because the circuit is closed while the system is trying to reach the host, while in the second one, the circuit is closed and the exception is thrown automatically without trying to reach the host.

Expand Down
8 changes: 4 additions & 4 deletions documentation/modules/ROOT/pages/10_health.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Some extensions may provide default health checks, including that the extension
For example, quarkus-agroal (which is used to manage Quarkus datasources) automatically registers a readiness health check that will validate each datasource.

Since the readiness of the database is already assessed just by adding those extensions, we should look into defining health checks for other dependencies that we have.
As we depend on the availability of https://swapi.dev, let's create a new `ReadinessProbe` to assess its availability prior to using it.
As we depend on the availability of https://swapi.build, let's create a new `ReadinessProbe` to assess its availability prior to using it.

We will define a new Java class in `src/main/java` in the `com.redhat.developers` package with the following contents:

Expand All @@ -128,7 +128,7 @@ public class CustomHealthCheck {
@Readiness //<1>
HealthCheck checkURL() {
return new UrlHealthCheck(externalURL+"/films/") //<2>
.name("ExternalURL health check").requestMethod(HttpMethod.GET).statusCode(200);
.name("ExternalURL health check").requestMethod(HttpMethod.GET).statusCode(202);
}

}
Expand Down Expand Up @@ -160,7 +160,7 @@ curl -w '\n' localhost:8080/health
"name": "ExternalURL health check",
"status": "UP",
"data": {
"host": "GET https://swapi.info/api/films"
"host": "GET https://swapi.build/api/films"
}
},
{
Expand Down Expand Up @@ -219,7 +219,7 @@ curl -w '\n' localhost:8080/health/ready
"name": "ExternalURL health check",
"status": "UP",
"data": {
"host": "GET https://swapi.info/api/films"
"host": "GET https://swapi.build/api/films"
}
},
{
Expand Down