Use the official RxJava to Reactive Streams adapter
This commit removes the usage of Reactor adapters (about to be moved from Reactor Core to a new Reactor Adapter module). Instead, RxReactiveStreams is now used for adapting RxJava 1 and Flowable methods are used for RxJava 2. Issue: SPR-14824
This commit is contained in:
@@ -24,9 +24,9 @@ import io.reactivex.netty.protocol.http.server.RequestHandler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.adapter.RxJava1Adapter;
|
||||
import reactor.core.publisher.Mono;
|
||||
import rx.Observable;
|
||||
import rx.RxReactiveStreams;
|
||||
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -64,7 +64,7 @@ public class RxNettyHttpHandlerAdapter implements RequestHandler<ByteBuf, ByteBu
|
||||
})
|
||||
.doOnSuccess(aVoid -> logger.debug("Successfully completed request"));
|
||||
|
||||
return RxJava1Adapter.publisherToObservable(result);
|
||||
return RxReactiveStreams.toObservable(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.net.URISyntaxException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.handler.codec.http.cookie.Cookie;
|
||||
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
|
||||
import reactor.adapter.RxJava1Adapter;
|
||||
import reactor.core.publisher.Flux;
|
||||
import rx.Observable;
|
||||
import rx.RxReactiveStreams;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
@@ -106,7 +106,7 @@ public class RxNettyServerHttpRequest extends AbstractServerHttpRequest {
|
||||
@Override
|
||||
public Flux<DataBuffer> getBody() {
|
||||
Observable<DataBuffer> content = this.request.getContent().map(dataBufferFactory::wrap);
|
||||
return RxJava1Adapter.observableToFlux(content);
|
||||
return Flux.from(RxReactiveStreams.toPublisher(content));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import io.netty.handler.codec.http.cookie.DefaultCookie;
|
||||
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
|
||||
import io.reactivex.netty.protocol.http.server.ResponseContentWriter;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.adapter.RxJava1Adapter;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import rx.Observable;
|
||||
import rx.RxReactiveStreams;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
@@ -72,9 +72,9 @@ public class RxNettyServerHttpResponse extends AbstractServerHttpResponse {
|
||||
|
||||
@Override
|
||||
protected Mono<Void> writeWithInternal(Publisher<DataBuffer> body) {
|
||||
Observable<ByteBuf> content = RxJava1Adapter.publisherToObservable(body)
|
||||
Observable<ByteBuf> content = RxReactiveStreams.toObservable(body)
|
||||
.map(NettyDataBufferFactory::toByteBuf);
|
||||
return RxJava1Adapter.observableToFlux(this.response.write(content))
|
||||
return Flux.from(RxReactiveStreams.toPublisher(this.response.write(content)))
|
||||
.then();
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ public class RxNettyServerHttpResponse extends AbstractServerHttpResponse {
|
||||
flatMap(publisher -> Flux.from(publisher).
|
||||
map(NettyDataBufferFactory::toByteBuf).
|
||||
concatWith(Mono.just(FLUSH_SIGNAL)));
|
||||
Observable<ByteBuf> content = RxJava1Adapter.publisherToObservable(bodyWithFlushSignals);
|
||||
Observable<ByteBuf> content = RxReactiveStreams.toObservable(bodyWithFlushSignals);
|
||||
ResponseContentWriter<ByteBuf> writer = this.response.write(content, bb -> bb == FLUSH_SIGNAL);
|
||||
return RxJava1Adapter.observableToFlux(writer).then();
|
||||
return Flux.from(RxReactiveStreams.toPublisher(writer)).then();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user