Version 2.0.0 of Eurorates Micronaut Library released

Reactive Streams implementation agnostic

Micronaut® framework 3 no longer exposes a Reactive Streams implementation :

Previous releases of the Micronaut® framework included RxJava2 as a transitive dependency, and RxJava2 was the reactive streams implementation used to implement many features within the Framework. The Micronaut® framework now no longer exposes any reactive streams implementation by default. In addition, all usages of RxJava2 internally have been replaced with Project Reactor.

It makes sense. Micronaut® framework is build agnostic. You can use Gradle or Maven. Micronaut® framework is JVM programming language agnostic. You can code in Java, Groovy or Kotlin. Now, it is reactive streams agnostic. You choose your favourite poison.

Eurorates updated to Micronaut® framework 3

I have released version 2.0.0 of Eurorates, a tiny Micronaut Java library which helps you consume the Euro foreign exchange reference rates. This new mayor release updates to Micronaut® framework 3 and changes the API to be Reactive Streams implementation agnostic. The library does not expose Rx Java 2 or any other reactive streams implementation library as transitive dependency anymore.

The main interface used to be:

public interface EuroRatesApi {
     Single<GesmesEnvelope> currentReferenceRates();
     Single<GesmesEnvelope> historicalReferenceRates();
     Single<GesmesEnvelope> last90DaysReferenceRates();
 }

Now, it is:

public interface EuroRatesApi {
     @SingleResult
     Publisher<GesmesEnvelope> currentReferenceRates();

     @SingleResult
     Publisher<GesmesEnvelope> historicalReferenceRates();

     @SingleResult
     Publisher<GesmesEnvelope> last90DaysReferenceRates();
 }

The API exposes a org.reactivestreams.Publisher. Moreover, I annotate the methods with Micronaut annotation @SingleResult.

Annotation that can be used to describe that an API emits a single result even if the return type is a Publisher.

We encourage library authors to write reactive streams agnostic libraries.

I use this library myself, for example, in Telegram bot: @ForeignExchangeRatesBot.

Tags: #micronaut
Aug 2021, 20.

 

My next events:
🗓 Oct 05 17:00 Jumpstart your Java applications with AWS Lambda and Micronaut