Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Quarkus Insights 2023-03-06

Quarkus Insights 2023-03-06

Julien Ponge

March 06, 2023
Tweet

More Decks by Julien Ponge

Other Decks in Programming

Transcript

  1. 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
  2. “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
  3. 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
  4. 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
  5. 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, …
  6. Mutiny Zero (44 Kilobytes JAR) RS <-> Flow Mutiny Zero

    Adapters Vert.x -based stream publishers Mutiny Zero — minimal helper libraries to make publishers