Skip to content

decisionbrain/reactor-scala-extensions

 
 

Repository files navigation

Reactor Scala Extensions

Join the chat at https://gitter.im/reactor/reactor Reactor Scala Extensions Download Build Status codecov

This project is a Scala extension for reactor-core.

Using reactor-core project as it is in scala code will look ugly because a lot of methods use Java 8 lambda which is not compatible with Scala lambda. This will force Scala code to use anonymous class which turns ugly.

So instead of

val mono = Mono.just(1)
               .map(new java.util.function.Function[Int, String] {
                   def apply(t: Int): String = t.toString
               })

it becomes

val mono = Mono.just(1).map(_.toString)

This extension will also return scala's scala.collection.immutable.Stream instead of Java's java.util.stream.Stream and scala.concurrent.Future instead of java.util.concurrent.CompletableFuture

Getting it

With Gradle:

repositories {
    //maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    mavenCentral()
}

dependencies {
    //compile "io.projectreactor:reactor-scala-extensions_2.12:0.3.6-SNAPSHOT
    //compile "io.projectreactor:reactor-scala-extensions_2.13.0-M3:0.3.5 //for scala 2.13.0-M3
    compile "io.projectreactor:reactor-scala-extensions_2.12:0.3.5 //for scala 2.12
    //compile "io.projectreactor:reactor-scala-extensions_2.11:0.3.5 //for scala 2.11
}

With Maven:

<!-- To get latest SNAPSHOT version from Sonatype
<repositories>
    <repository>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>ossSonatypeSnapshot</id>
        <name>OSS Sonatype Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <layout>default</layout>
    </repository>
 </repositories>

<dependency>
    <groupId>io.projectreactor</groupId>
    <artifactId>reactor-scala-extensions</artifactId>
    <version>0.3.6-SNAPSHOT</version>
</dependency>
-->
<dependency>
    <groupId>io.projectreactor</groupId>
    <artifactId>reactor-scala-extensions_2.12</artifactId> <!-- for scala 2.12 -->
    <!--<artifactId>reactor-scala-extensions_2.11</artifactId> for scala 2.11 -->
    <!--<artifactId>reactor-scala-extensions_2.13.0-M3</artifactId> for scala 2.13.0-M3 -->
    <version>0.3.5</version>
</dependency>

Contributing

Contributions are welcome. Simply fork this project, make some modification, push and create a pull request.

About

A scala extension for Reactor Flux and Mono

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%