From 71f806ec2a95abc89fc641a1a362ae91fa124ddd Mon Sep 17 00:00:00 2001 From: Austin Seto Date: Mon, 23 Nov 2020 11:32:47 -0500 Subject: [PATCH 1/5] Remove redundant dependency --- README.adoc | 2 +- finish/query/pom.xml | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/README.adoc b/README.adoc index 9afad068..ea142824 100644 --- a/README.adoc +++ b/README.adoc @@ -222,7 +222,7 @@ These custom objects provide a simpler and faster way for you to create scalable `query/pom.xml` ---- -The [hotspot=jerseyRxjava file=0]`jersey-rx-client-rxjava` and [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependencies provide the `RxInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. +The [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency provides the `RxInvokerProvider` class, which is registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. Update the client to accommodate the custom object types that you are trying to return. You'll need to register the type of object that you want inside the client invocation. diff --git a/finish/query/pom.xml b/finish/query/pom.xml index 387d75cd..fb0874e8 100644 --- a/finish/query/pom.xml +++ b/finish/query/pom.xml @@ -60,13 +60,6 @@ 2.30 - - - org.glassfish.jersey.ext.rx - jersey-rx-client-rxjava - 2.30 - - org.glassfish.jersey.ext.rx From 7db0eae28271e8aa5a6feef55b799470991862ca Mon Sep 17 00:00:00 2001 From: Austin Seto Date: Mon, 23 Nov 2020 12:07:47 -0500 Subject: [PATCH 2/5] Revert application changes, update README to better describe Flowable --- README.adoc | 3 ++- finish/query/pom.xml | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index ea142824..f5bad0f1 100644 --- a/README.adoc +++ b/README.adoc @@ -222,7 +222,7 @@ These custom objects provide a simpler and faster way for you to create scalable `query/pom.xml` ---- -The [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency provides the `RxInvokerProvider` class, which is registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. +The [hotspot=jerseyRxJava file=0]`jersey-rx-client-rxjava` dependency provides us the `RxObservableInvoker` and `RxObservableInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. Update the client to accommodate the custom object types that you are trying to return. You'll need to register the type of object that you want inside the client invocation. @@ -247,6 +247,7 @@ In the [hotspot=getSystem file=1]`getSystem()` method, the [hotspot=register fil In some scenarios, a producer might generate more data than the consumers can handle. JAX-RS can deal with cases like these by using the RxJava `Flowable` class with backpressure. +The `RxFlowableInvoker` and `RxFlowableInvokerProvider` classes are provided by the [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency which is included if you wish to try it. To learn more about RxJava and backpressure, see https://openliberty.io/blog/2019/04/10/jaxrs-reactive-extensions.html[JAX-RS reactive extensions with RxJava backpressure^]. == Updating the REST resource to support the reactive JAX-RS client diff --git a/finish/query/pom.xml b/finish/query/pom.xml index fb0874e8..40d6b5e6 100644 --- a/finish/query/pom.xml +++ b/finish/query/pom.xml @@ -57,14 +57,21 @@ org.glassfish.jersey.core jersey-client - 2.30 + 2.32 + + + org.glassfish.jersey.ext.rx + jersey-rx-client-rxjava + 2.32 + + org.glassfish.jersey.ext.rx jersey-rx-client-rxjava2 - 2.30 + 2.32 From 26a990b38e46f4bcae913a77801b78ac139fc8fe Mon Sep 17 00:00:00 2001 From: Austin Seto Date: Mon, 23 Nov 2020 12:15:44 -0500 Subject: [PATCH 3/5] Minor wording update --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index f5bad0f1..e2fe7c91 100644 --- a/README.adoc +++ b/README.adoc @@ -247,7 +247,7 @@ In the [hotspot=getSystem file=1]`getSystem()` method, the [hotspot=register fil In some scenarios, a producer might generate more data than the consumers can handle. JAX-RS can deal with cases like these by using the RxJava `Flowable` class with backpressure. -The `RxFlowableInvoker` and `RxFlowableInvokerProvider` classes are provided by the [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency which is included if you wish to try it. +The `RxFlowableInvoker` and `RxFlowableInvokerProvider` classes are provided by the [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency, which is included to try as an optional exercise. To learn more about RxJava and backpressure, see https://openliberty.io/blog/2019/04/10/jaxrs-reactive-extensions.html[JAX-RS reactive extensions with RxJava backpressure^]. == Updating the REST resource to support the reactive JAX-RS client From 022df45a0bd226660f56b9cb5e28bea2c55cfbe2 Mon Sep 17 00:00:00 2001 From: Austin Seto Date: Tue, 24 Nov 2020 12:00:47 -0500 Subject: [PATCH 4/5] Remove rxjava2 --- README.adoc | 3 +-- finish/query/pom.xml | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/README.adoc b/README.adoc index e2fe7c91..77eec007 100644 --- a/README.adoc +++ b/README.adoc @@ -222,7 +222,7 @@ These custom objects provide a simpler and faster way for you to create scalable `query/pom.xml` ---- -The [hotspot=jerseyRxJava file=0]`jersey-rx-client-rxjava` dependency provides us the `RxObservableInvoker` and `RxObservableInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. +The [hotspot=jerseyRxjava file=0]`jersey-rx-client-rxjava` dependency provides us the `RxObservableInvoker` and `RxObservableInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. Update the client to accommodate the custom object types that you are trying to return. You'll need to register the type of object that you want inside the client invocation. @@ -247,7 +247,6 @@ In the [hotspot=getSystem file=1]`getSystem()` method, the [hotspot=register fil In some scenarios, a producer might generate more data than the consumers can handle. JAX-RS can deal with cases like these by using the RxJava `Flowable` class with backpressure. -The `RxFlowableInvoker` and `RxFlowableInvokerProvider` classes are provided by the [hotspot=jerseyRxjava2 file=0]`jersey-rx-client-rxjava2` dependency, which is included to try as an optional exercise. To learn more about RxJava and backpressure, see https://openliberty.io/blog/2019/04/10/jaxrs-reactive-extensions.html[JAX-RS reactive extensions with RxJava backpressure^]. == Updating the REST resource to support the reactive JAX-RS client diff --git a/finish/query/pom.xml b/finish/query/pom.xml index 40d6b5e6..fe7ef9e5 100644 --- a/finish/query/pom.xml +++ b/finish/query/pom.xml @@ -67,13 +67,6 @@ 2.32 - - - org.glassfish.jersey.ext.rx - jersey-rx-client-rxjava2 - 2.32 - - org.microshed From 3bd13724ef5e68946de8a4bae67cb8aa022abc40 Mon Sep 17 00:00:00 2001 From: Austin Seto Date: Tue, 24 Nov 2020 12:06:17 -0500 Subject: [PATCH 5/5] Reorder content of section --- README.adoc | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/README.adoc b/README.adoc index 77eec007..6190fac6 100644 --- a/README.adoc +++ b/README.adoc @@ -210,22 +210,16 @@ pom.xml include::finish/query/pom.xml[] ---- -Although JAX-RS provides the default reactive provider that returns `CompletionStage` types, you can alternatively use another provider that supports other reactive frameworks like https://github.com/ReactiveX/RxJava[RxJava^]. -The Apache CXF and Eclipse Jersey projects produce such providers. -You'll now update the web client to use the Jersey reactive provider for RxJava. -With this updated reactive provider, you can write clients that use RxJava objects instead of clients that use only the `CompletionStage` interface. -These custom objects provide a simpler and faster way for you to create scalable RESTful services with a `CompletionStage` interface. - -[role="code_command hotspot file=0", subs="quotes"] +InventoryClient.java +[source, java, linenums, role='code_column hide_tags=copyright'] ---- -#Replace the Maven configuration file.# -`query/pom.xml` +include::finish/query/src/main/java/io/openliberty/guides/query/client/InventoryClient.java[] ---- -The [hotspot=jerseyRxjava file=0]`jersey-rx-client-rxjava` dependency provides us the `RxObservableInvoker` and `RxObservableInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. - -Update the client to accommodate the custom object types that you are trying to return. -You'll need to register the type of object that you want inside the client invocation. +Although JAX-RS provides the default reactive provider that returns `CompletionStage` types, you can alternatively use another provider that supports other reactive frameworks like https://github.com/ReactiveX/RxJava[RxJava^]. +The Apache CXF and Eclipse Jersey projects produce such providers. +You'll now update the web client to use the Jersey reactive provider for RxJava. +Update the client to use the `Observable` object type. [role="code_command hotspot file=1", subs="quotes"] ---- @@ -233,18 +227,23 @@ You'll need to register the type of object that you want inside the client invoc `query/src/main/java/io/openliberty/guides/query/client/InventoryClient.java` ---- -InventoryClient.java -[source, java, linenums, role='code_column hide_tags=copyright'] ----- -include::finish/query/src/main/java/io/openliberty/guides/query/client/InventoryClient.java[] ----- - The return type of the [hotspot=getSystem file=1]`getSystem()` method is now an `Observable` object instead of a `CompletionStage` interface. http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html[Observable^] is a collection of data that waits to be subscribed to before it can release any data and is part of RxJava. The [hotspot=rx file=1]`rx()` method now needs to contain `RxObservableInvoker.class` as an argument. This argument calls the specific invoker, `RxObservableInvoker`, for the `Observable` class that's provided by Jersey. In the [hotspot=getSystem file=1]`getSystem()` method, the [hotspot=register file=1]`register(RxObservableInvokerProvider)` method call registers the `RxObservableInvoker` class, which means that the client can recognize the invoker provider. +With this updated reactive provider, you can write clients that use RxJava objects instead of clients that use only the `CompletionStage` interface. +These custom objects provide a simpler and faster way for you to create scalable RESTful services with a `CompletionStage` interface. + +[role="code_command hotspot file=0", subs="quotes"] +---- +#Replace the Maven configuration file.# +`query/pom.xml` +---- + +The [hotspot=jerseyRxjava file=0]`jersey-rx-client-rxjava` dependency provides us the `RxObservableInvoker` and `RxObservableInvokerProvider` classes, which are registered to the [hotspot=jerseyClient file=0]`jersey-client` `ClientBuilder` class. + In some scenarios, a producer might generate more data than the consumers can handle. JAX-RS can deal with cases like these by using the RxJava `Flowable` class with backpressure. To learn more about RxJava and backpressure, see https://openliberty.io/blog/2019/04/10/jaxrs-reactive-extensions.html[JAX-RS reactive extensions with RxJava backpressure^].