Slide 1

Slide 1 text

java.util.stream.* java.util.concurrent.Flow.* 2 kinds of “stream” APIs Efficient in-memory data stream processing Backpressured async I/O data stream processing

Slide 2

Slide 2 text

“Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure.” — https:/ /www.reactive-streams.org/ Mutiny! Photo by Arno Senoner on Unsplash

Slide 3

Slide 3 text

org.reactivestreams.* (Java 6 legacy) java.util.concurrent.Flow.* (since JDK 9) Back-pressured, asynchronous, non-blocking (see Reactive Streams TCK) < your own library / client / driver / … > APIs Protocol User-facing APIs

Slide 4

Slide 4 text

return flux .filter(n -> n % 2 == 0) .map(n -> "[" + n + "]") .flatMap(Database :: record) .retry(5); return multi .select().where(n -> n % 2 == 0) .onItem().transform(n -> "[" + n + "]") .onItem().transformToUniAndMerge(Database :: record) .onFailure() .retry() .withBackOff(Duration.ofSeconds(1)) .atMost(5); RxJava / Reactor Mutiny Functional dialect, fl at 100+ methods list Event-based dialect, group-based api

Slide 5

Slide 5 text

Ok, 4 interfaces. Must be easy, right? Publisher Subscriber Processor Subscription

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Migrate to Flow Use adapters Strategies: from legacy to Flow Support both APIs New APIs. Same TCK. Best for 3rd-party libraries that haven’t migrated yet. Virtually no-cost. Transition for user code: RESTEasy Reactive, Reactive Messaging, …

Slide 12

Slide 12 text

Mutiny Zero (44 Kilobytes JAR) RS <-> Flow Mutiny Zero Adapters Vert.x -based stream publishers Mutiny Zero — minimal helper libraries to make publishers