jkoehler22 commented on a change in pull request #451: CXF-7854: Refactor 
RxJava2 Flowable and Observable Rx Invokers to not…
URL: https://github.com/apache/cxf/pull/451#discussion_r222014882
 
 

 ##########
 File path: 
rt/rs/extensions/rx2/src/main/java/org/apache/cxf/jaxrs/rx2/client/FlowableRxInvokerImpl.java
 ##########
 @@ -147,34 +150,90 @@ public FlowableRxInvokerImpl(WebClient wc, 
ExecutorService ex) {
 
     @Override
     public <T> Flowable<T> method(String name, Entity<?> entity, Class<T> 
responseType) {
+        
+        Flowable<T> flowable = Flowable.create(new FlowableOnSubscribe<T>() {
+            @Override
+            public void subscribe(FlowableEmitter<T> emitter) throws Exception 
{
+                    try {
+                        T response = syncInvoker.method(name, entity, 
responseType);
+                        emitter.onNext(response);
+                        emitter.onComplete();
+                    } catch (Throwable e) {
+                        emitter.onError(e);
+                    }
+            }
+        }, BackpressureStrategy.DROP);
+        
         if (sc == null) {
-            return Flowable.fromFuture(wc.async().method(name, entity, 
responseType));
+            return flowable;
         }
-        return Flowable.fromFuture(wc.async().method(name, entity, 
responseType), sc);
+        return flowable.subscribeOn(sc).observeOn(sc);        
     }
 
     @Override
     public <T> Flowable<T> method(String name, Entity<?> entity, 
GenericType<T> responseType) {
+        
+        Flowable<T> flowable = Flowable.create(new FlowableOnSubscribe<T>() {
+            @Override
+            public void subscribe(FlowableEmitter<T> emitter) throws Exception 
{
 
 Review comment:
   Agree.  Thanks for the comments.  Done.

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


With regards,
Apache Git Services

Reply via email to