Micronaut RxJava 2

Integration between Micronaut and RxJava 2

Version:

1 Introduction

Adds support for RxJava 2 to a Micronaut application.

2 Release History

For this project, you can find a list of releases (with release notes) here:

3 Converters and Instrumentation

The following dependency includes:

implementation("io.micronaut.rxjava2:micronaut-rxjava2:1.0.1-SNAPSHOT")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2</artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

  • 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

4 RxJava2 HTTP Client

To use the HTTP client add the following dependency:

implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.0.1-SNAPSHOT")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2-http-client</artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

To use the RxJava 2 variation of the Micronaut HTTP client inject the RxHttpClient interface (or one of the other variants). For example:

import io.micronaut.rxjava2.http.client.*;

@Inject Rx2HttpClient httpClient; // regular client
@Inject Rx2SseClient sseClient; // server sent events
@Inject Rx2StreamingHttpClient streamingClient; // streaming

5 Netty Body Binders

If 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:1.0.1-SNAPSHOT")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2-http-server-netty</artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

6 Repository

You can find the source code of this project in this repository: