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

Nonblocking Java Async Processing - how to constrain memory usage?

I'm coming back to Java after a few years away, and have been excited to see the introduction of non-blocking async support in the new java.net.http.HttpClient and in the AWS Java SDK 2.0. I heard about the concepts of Reactive Programming years…
3
votes
1 answer

Is it safe to use the same FluxSink from multiple threads concurrently

I know a Publisher must not publish concurrently, but if I use Flux#create(FluxSink), can I safely call FluxSink#next concurrently? In other words, does Spring have internal magic that ensures proper serial publishing of events even if FluxSink#next…
kaqqao
  • 12,984
  • 10
  • 64
  • 118
3
votes
1 answer

How to call both subscribe and blockLast on Flux?

I have been experimenting with Project Reactor and reactive streams in general. I encountered an issue when using subscribeOn to make stream run on a different thread. Having my code in a main, I need main thread block until the stream finishes, so…
Nima Ajdari
  • 2,754
  • 2
  • 14
  • 18
3
votes
1 answer

Complete request with latest item in a flow

I'd like to complete a GET request with the latest available item in a flow. This flow in particular aggregates events produced by an actor and already individually consumed by a WebSocket. Let's say that the event can be represented as…
stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
3
votes
1 answer

Spring Boot Webflux - Set UTF-8 Encoding

I've been working with Spring Boot 2.0.0.RC1 and use spring-boot-starter-webflux in order to build a REST Controller that returns a flux of text data. @GetMapping(value = "/") public Flux getData(){ return…
3
votes
2 answers

Is there a way to print out the chain of all operations in a Flux?

Given a Flux or a Mono from project reactor is a there a way to get the Flux or Mono to print out what the operator chain looks like. For example given the code below. Fulx flux = Flux.just("a","b","c") .map( v -> v.toUpperCase()) …
ams
  • 60,316
  • 68
  • 200
  • 288
3
votes
3 answers

Single Stream and Multiple Subscribers

I'm testing the waters with Java9 reactive streams and RxJava2. I dont really have a preference on either but am looking for some guidance on if this is possible. I'm creating a pre-configured amount of subscribers like so: for(int i = 0;…
3
votes
1 answer

Difference between Flux.concat and Flux.concatWith

I am new to reactive streams and learning the combine two publishers (Flux to be specific) using the concat/concatWith methods. Everything which i can do with concat method, the same can be achieved using the concatWith method. Here is the sample…
KayV
  • 12,987
  • 11
  • 98
  • 148
3
votes
2 answers

Why are there HandlerFunctions in Spring 5 webflux?

I am learning the spring 5 webflux and reactive streams. And there are new HandlerFunctions and RouterFunctions to implement the Http requests and response. and as per the documentations: The annotation counterpart to a handler function would be a…
KayV
  • 12,987
  • 11
  • 98
  • 148
3
votes
3 answers

Good implementation/support for java.util.concurrent.Flow.Processor

Recently, I found a good support for Publisher by projectreactor.io: Flux.create(fluxSink -> { for (int i = 0; i < 10; i++) fluxSink.next(i); fluxSink.complete(); }) .map(...) …
3
votes
1 answer

Spring WebFlux: block() method return null in Spring Data Reactive MongoDB

i'm trying to learn project Reactor and have the problem. @Test @DisplayName("check that standaloneUser fields are correct") void validateUserFields() { userService.save(standaloneUser).subscribe(); assertEquals(userService.count().block(),…
3
votes
1 answer

Is it generally OK to use a Reactive Streams Processor as an event bus?

I started learning about reactive streams because I was curious about this new trend of using RxJava as a replacement for more traditional event buses. This blog post is a typical description of how this is done. If I understand correctly, RxJava…
Kevin Krumwiede
  • 9,868
  • 4
  • 34
  • 82
3
votes
2 answers

Backpressure strategies for Akka Stream Source.queue not working

I'm trying to understand why the below code snippet is doing what it's doing. I would have thought that because the Sink cannot produce demand faster than the Source is producing content, then I would be getting dropped messages in response to some…
bmooney
  • 391
  • 6
  • 15
3
votes
1 answer

Akka Streams filter & group by on a collection of keys

I have a stream of case class Msg(keys: Seq[Char], value: String) Now I want to filter for a subset of keys e.g. val filterKeys = Set[Char]('k','f','c') and Filter(k.exists(filterKeys.contains))) And then split these so certain keys are processed…
NightWolf
  • 7,694
  • 9
  • 74
  • 121
3
votes
2 answers

Akka Reactive Streams always one message behind

For some reason, my Akka streams always wait for a second message before "emitting"(?) the first. Here is some example code that demonstrates my problem. val rx = Source((1 to 100).toStream.map { t => Thread.sleep(1000) println(s"doing $t") …
SGHAF
  • 105
  • 1
  • 1
  • 5