Questions tagged [reactive-streams]

a standard for asynchronous stream processing with non-blocking back pressure on the JVM

Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure on the JVM.

http://www.reactive-streams.org/

358 questions
9
votes
2 answers

How to use Reactive Streams for NIO binary processing?

Are there some code examples of using org.reactivestreams libraries to process large data streams using Java NIO (for high performance)? I'm aiming at distributed processing, so examples using Akka would be best, but I can figure that out. It still…
Stephen
  • 19,488
  • 10
  • 62
  • 83
8
votes
3 answers

Pushing elements externally to a reactive stream in fs2

I have an external (that is, I cannot change it) Java API which looks like this: public interface Sender { void send(Event e); } I need to implement a Sender which accepts each event, transforms it to a JSON object, collects some number of them…
Vladimir Matveev
  • 120,085
  • 34
  • 287
  • 296
8
votes
2 answers

Project reactor: onErrorResume after flatMap

Flux.just("a", "b") .flatMap(s -> s.equals("a") ? Mono.error(new RuntimeException() : Flux.just(s + "1", s + "2")) .onErrorResume(throwable -> Mono.empty()) .subscribe(System.out::println); Hello! Here I made a flux of two…
gdomo
  • 1,650
  • 1
  • 9
  • 18
8
votes
2 answers

Reactive Streams - batching with timeout

I am looking into replacing a homegrown log processing library which looks awfully close to ReactiveStreams with io.projectreactor. The objective is to reduce the code we maintain, and take advantage of any new features added by the community…
8
votes
5 answers

Combining result from Flux to result from Mono

I started using Project reactor and one place where I'm struggling little is how do I combine things coming from Mono with Flux. Here's my use case: public interface GroupRepository { Mono getGroup(Long groupId); } public…
User5817351
  • 989
  • 2
  • 16
  • 36
8
votes
1 answer

Akka HTTP: How to unmarshal Json format response into domain objects

I am trying out Akka HTTP, and I have created a service that returns a Json Array of domain objects in HttpResponse. In the client I want to convert it to a Source of domain objects so it can be consumed by the subsequent Flows and Sinks. Referring…
pumpump
  • 361
  • 2
  • 15
7
votes
1 answer

Whats the difference between flatMap, flatMapSequential and concatMap in Project Reactor?

I've read from the documentation that flatMap: Transform the elements emitted by this Flux asynchronously into Publishers, then flatten these inner publishers into a single Flux through merging, which allow them to interleave. that…
7
votes
2 answers

Java reactor - chain Mono with another async task producing Mono
I have the below async tasks: public class AsyncValidationTask { // Returns Mono.error(new Exception()) if error, otherwise Mono.empty() public Mono execute(Object o); } public class AsyncSaveTask { // Returns Mono.error(new…
GJ.
  • 870
  • 5
  • 9
  • 26
7
votes
0 answers

Which operations are easier to implement in pull vs push models in streaming libraries (and vice versa)?

Author of Monix says in comparison of Monix with FS2 Where FS2 is better: the model of communication between producers and consumers is pull-based, sometimes making it easier to implement new operators Where Monix is better: the model of…
visa
  • 300
  • 2
  • 10
7
votes
2 answers

Project Reactor: doOnNext (or the others doOnXXX) async

Is there any method like doOnNext, but async? For example, I need to do some long logging (sent notification by email) for determined element. Scheduler myParallel = Schedulers.newParallel("my-parallel", 4); Flux ints = Flux.just(1, 2, 3,…
7
votes
1 answer

akka stream consume web socket

Getting started with akka-streams I want to build a simple example. In chrome using a web socket plugin I simply can connect to a stream like this one https://blockchain.info/api/api_websocket via wss://ws.blockchain.info/inv and sending 2…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
7
votes
1 answer

Integration Testing Spring SseEmitters

I've been looking for hints on how to best test Spring MVC Controller methods that return SseEmitters. I have come up pretty short, but have a trial-and-error solution that tests against asynchronous, threaded behavior. The below is sample code…
7
votes
5 answers

Multiple enums vs One enum

I was looking at the example implementation of Publisher (AsyncIterablePublisher.java) of the reactive-streams spec when I stumbled into something that I don't understand why it was done that way. static interface Signal {}; enum Cancel implements…
Juru
  • 1,623
  • 17
  • 43
6
votes
1 answer

transform vs transformDeferred

What is the difference between transform & transformDeferred in project reactor flux. Good example will be helpful. https://projectreactor.io/docs/core/release/reference/index.html#advanced-mutualizing-operator-usage
6
votes
1 answer

Project Reactor: ConnectableFlux auto-connecting on demand

I have a single source of data items and I want to share that Flux with multiple downstream streams. It is very similar to the example in the reference guide, but I feel that example cheats by calling .connect() manually. Specifically, I do not…
Anly
  • 312
  • 3
  • 11
1 2
3
23 24