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
6
votes
1 answer

How to download and process large data reactively?

I need to initiate download of some content over HTTP and then read the data as a reactive stream. So, even though the downloaded data are big, I can almost immediately read the first few bytes of the response body (no need to wait for the whole…
Martin Heralecký
  • 5,649
  • 3
  • 27
  • 65
6
votes
2 answers

In spring boot webflux based microservice, who is the subscriber?

Note: Here the terms Subscriber and Subscription are being used from the reactive streams specification. Consider the following @RestController methods in a spring boot webflux based microservice. @GetMapping(path = "/users", produces =…
Jatin
  • 667
  • 8
  • 16
6
votes
2 answers

Multiple sinks in the same stream

I have a stream like this and two sinks, but only one is used at a time: Source.fromElements(1, 2, 3) .via(flow) .runWith(sink1) or Source.fromElements(1, 2, 3) .via(flow) .runWith(sink2) It is configurable which sink we use, but what if I have…
Piotr Kozlowski
  • 899
  • 1
  • 13
  • 25
6
votes
2 answers

Java 9 Behavior of Flow SubmissionPublisher offer method

I´ve been playing with Java Flow offer operator but after read the documentation and do my test I dont understand. Here my test @Test public void offer() throws InterruptedException { //Create Publisher for expected items Strings …
paul
  • 12,873
  • 23
  • 91
  • 153
6
votes
1 answer

Akka Streams split stream by type

I have the following simple case class hierarchy: sealed trait Message case class Foo(bar: Int) extends Message case class Baz(qux: String) extends Message And I have a Flow[Message, Message, NotUsed] (from a Websocket-based protocol with codec…
Alexander Temerev
  • 2,654
  • 3
  • 27
  • 34
6
votes
1 answer

Creating a Source out of an EventStream

I am using PlayFramework 2.5.3 and would like to create an akka.stream.scaladsl.Source from an akka.event.EventStream (the eventstream is part of an actor system). The event stream would produce events from a certain type, so I would need to…
6
votes
2 answers

Scala Slick: Never ending stream

With Slick you can do the following to produce a stream of results from a table: val q = for (e <- events) yield e.name val p: DatabasePublisher[String] = db.stream(q.result) p.foreach { s => println(s"Event: $s") } That will print all the events…
David
  • 1,862
  • 2
  • 22
  • 35
6
votes
1 answer

spring integration vs reactive-streams

I'm working on an ETL project. I've been using spring integration for a long time. The data source is currently files or chronicle but it may change to live streams and volumes are likely to grow. There is a potential to move on to big data…
6
votes
1 answer

How to merge two streams (without nulls) and apply conditions on pairs?

Consider I have two streams of data, is there a way to merge them and apply conditions on data between these two streams? For example Stream A : A, B, C, D.... Stream B : -, A, -, -.... Composed : (A,-),(B,A),(C,-),(D,-).... How to get composed…
opensourcegeek
  • 5,552
  • 7
  • 43
  • 64
5
votes
2 answers

publishOn vs subscribeOn when making a blocking call in Reactor

In the blog post Flight of the Flux 3, the authors suggest wrapping a synchronous blocking call in a Mono with a subscribeOn call, as shown in this snippet from the article: final Flux betterFetchUrls(List urls) { return…
kousen
  • 2,897
  • 3
  • 28
  • 26
5
votes
0 answers

How to mock FindPublisher in reactive mongo driver

I'm writing an application using mongo reactive driver and reactivestreams library in Java. I have the following DAO code: @Override public Flux findBySearch(String appKey, ContentVersionSearchRequest request, Pager pager) { …
sedran
  • 3,498
  • 3
  • 23
  • 39
5
votes
1 answer

What is the difference between Schedulers.newElastic and Schedulers.elastic methods?

I am working on Flux and Mono and using them in multi threaded environment and using the Schedular which provide the worker thread. There are many options to start the Schedular using elastic, parallel and newElastic. Here is the code which i used: …
KayV
  • 12,987
  • 11
  • 98
  • 148
5
votes
2 answers

How to convert cold stream into hot stream in Project Reactor 3?

As per the definition of Mono and Flux, both represent an asynchronous sequence of data, and nothing happens before you subscribe. And there are two broad families of publishers: hot and cold. Mono and Flux generate data anew for each subscription.…
5
votes
1 answer

Asynchronous, composable return value for vector/stream data in Java 9

Say I have an API that, based on some query criteria, will find or construct a widget: Widget getMatchingWidget(WidgetCriteria c) throws Throwable The (synchronous) client code looks like: try { Widget w = getMatchingWidget(criteria); …
David Moles
  • 48,006
  • 27
  • 136
  • 235
5
votes
2 answers

How to correctly wrap a Flux inside a Mono object

I have a web-service which returns student and enrolled class details. { "name": "student-name", "classes": [ { "className": "reactor-101", "day": "Tuesday" }, { "className": "reactor-102", "day": "Friday" …