Rxjava2
Adds support for RxJava 2 to a Micronaut application.
For this project, you can find a list of releases (with release notes) here:
Add the following dependency to your Micronaut application:
implementation("io.micronaut.rxjava2:micronaut-rxjava2")The following dependency includes:
implementation("io.micronaut.rxjava2:micronaut-rxjava2")-
Converters for RxJava 2 types so that RxJava 2 types can be used in controllers and clients
-
Instrumentation for RxJava 2 types so that tracing works with RxJava 2 types
To use the HTTP client add the following dependency:
implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-client")To use the RxJava 2 variation of the Micronaut HTTP client inject the RxHttpClient interface (or one of the other variants). For example:
imports
import io.micronaut.rxjava2.http.client.*;@Inject Rx2HttpClient httpClient; // regular client
@Inject Rx2SseClient sseClient; // server sent events
@Inject Rx2StreamingHttpClient streamingClient; // streamingIf you are using Micronaut with Netty, add the following dependency to bind the HTTP Request’s body to a RxJava 2 types (Single, Maybe, Observable)
implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-server-netty")You can find the source code of this project in this repository: