Micronaut RxJava 2

Integration between Micronaut and RxJava 2

Version: 2.5.0

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 Quick Start

Add the following dependency to your Micronaut application:

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

4 Converters and Instrumentation

The following dependency includes:

implementation("io.micronaut.rxjava2:micronaut-rxjava2")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2</artifactId>
</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

5 RxJava2 HTTP Client

To use the HTTP client add the following dependency:

implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-client")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2-http-client</artifactId>
</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

6 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")
<dependency>
    <groupId>io.micronaut.rxjava2</groupId>
    <artifactId>micronaut-rxjava2-http-server-netty</artifactId>
</dependency>

7 Repository

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