reta commented on a change in pull request #542: CXF-8022: Thread hangs using 
Reactor Flux when Exception is Thrown
URL: https://github.com/apache/cxf/pull/542#discussion_r276878394
 
 

 ##########
 File path: 
rt/rs/extensions/reactor/src/main/java/org/apache/cxf/jaxrs/reactor/client/ReactorInvokerImpl.java
 ##########
 @@ -201,13 +202,15 @@
     @Override
     public <T> Flux<T> flux(String name, Entity<?> entity, Class<T> 
responseType) {
         Future<Response> futureResponse = webClient.async().method(name, 
entity);
-        return Flux.fromIterable(toIterable(futureResponse, responseType));
+        return Flux.fromStream(() -> 
+            StreamSupport.stream(toIterable(futureResponse, 
responseType).spliterator(), false));
     }
 
     @Override
     public <T> Flux<T> flux(String name, Class<T> responseType) {
         Future<Response> futureResponse = webClient.async().method(name);
-        return Flux.fromIterable(toIterable(futureResponse, responseType));
+        return Flux.fromStream(() -> 
 
 Review comment:
   So when the `toIterable` fails (fe empty response, or alike), it does thrown 
the exception from `getFlux` method, which is unexpected. Instead, the 
exception should be propagated using `onError` callback, following the reactive 
stream. Using the supplier fixes that.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to