Questions tagged [reactor]

The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs. The service handler demultiplexes the incoming requests and dispatches them synchronously to the associated request handlers.

582 questions
95
votes
3 answers

Akka or Reactor

I am in the process of starting a new project (java-based). I need to build it as a modular, distributed and resilient architecture. Therefore I would like to have the business processes to communicate among themselves, be interoperable, but also…
David Riccitelli
  • 6,847
  • 4
  • 37
  • 54
65
votes
1 answer

Correct way of throwing exceptions with Reactor

I'm new to project Reactor and reactive programming in general. I'm currently working on a piece of code similar to this: Mono.just(userId) .map(repo::findById) .map(user-> { if(user == null){ throw new…
davioooh
  • 20,249
  • 33
  • 132
  • 224
40
votes
1 answer

Netflix RxJava vs Spring Reactor

I am evaluating reactor library for using it in our project. I googled a lot but couldn't find the difference(pros /cons) between Netflix's RxJava and Spring's Reactor API. can someone please help me in deciding or provide some pointers? Thanks.
Roy
  • 559
  • 1
  • 4
  • 6
27
votes
2 answers

What are worker threads, and what is their role in the reactor pattern?

I'm trying to understand the Reactor pattern (concurrent), but in many examples they are talking about 'worker threads'. What are worker threads? In what way do they differ from 'normal' threads? And what is their role in the reactor pattern?
Jon
  • 427
  • 1
  • 5
  • 11
26
votes
2 answers

How does Python's Twisted Reactor work?

Recently, I've been diving into the Twisted docs. From what I gathered, the basis of Twisted's functionality is the result of it's event loop called the "Reactor". The reactor listens for certain events and dispatches them to registered callback…
deadlock
  • 6,181
  • 11
  • 58
  • 105
25
votes
10 answers

How to set a timeout in Spring 5 WebFlux WebClient

I'm trying to set timeout on my WebClient, here is the current code : SslContext sslContext = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build(); ClientHttpConnector httpConnector = new…
Seb
  • 2,504
  • 7
  • 27
  • 44
24
votes
9 answers

Spring Webflux : Webclient : Get body on error

I am using the webclient from spring webflux, like this : WebClient.create() .post() .uri(url) .syncBody(body) .accept(MediaType.APPLICATION_JSON) .headers(headers) .exchange() …
adrien le roy
  • 453
  • 2
  • 4
  • 11
21
votes
2 answers

Stop twisted reactor on a condition

Is there a way to stop the twisted reactor when a certain condition is reached. For example, if a variable is set to certain value, then the reactor should stop?
gmemon
  • 2,213
  • 5
  • 29
  • 34
19
votes
2 answers

Multiple reactors (main loops) in one application through threading (or alternative means)

I've got an idea for an app I'd like to work on to learn a bit more about Twisted and WebSockets. I was thinking of integrating a previously written IRC Bot into a web application. As far as I can see it, I would need three reactors to make it…
Mike Trpcic
  • 23,821
  • 7
  • 71
  • 111
11
votes
3 answers

Asynchronous sequential calls based on condition checks in reactor

Here, I am trying to make asynchronous and non-blocking calls using reactor and for each request, I may have to call two services in sequence (in my case below, getAccountInfoFromAAA and getAccountInfoFromBBB). Here is my ItemRequest object: public…
Vijaya Pandey
  • 3,963
  • 4
  • 31
  • 53
11
votes
2 answers

Why does Spring Webflux only accepts 256 requests in parallel?

In the default configuration Spring Webflux seems to limit the number of parallel requests to 256. My setup has this very simple controller: @RestController public class SimpleRestController { private final Log logger =…
tkr
  • 1,241
  • 1
  • 7
  • 26
10
votes
3 answers

Java Reactor Pattern with java.io Package

I see in several application source like Minecraft and JIrcs they both use java.io to implement Reactor Plugin (if I'm not wrong) and also in this article. So, what is the difference between java.io and java.nio when implementing Reactor Pattern? I…
pengemizt
  • 810
  • 9
  • 15
10
votes
2 answers

How to convert List> to Mono>?

I have a method that returns Mono: interface Processor { Mono process(Input input); } And I want to execute this processor method for a collection: List inputs = // get inputs Processor processor = // get…
Ilya Zinkovich
  • 3,058
  • 2
  • 16
  • 33
10
votes
1 answer

How to get Flux or List from two Flux(Object) in Spring Reactive Programming?

I am new to Spring Reactive Project. In my Spring Boot Controller class I have Flux ( list of all houses in the database) and Flux coming from service layer where given Flux are images for a given House like a list of…
ace
  • 12,531
  • 35
  • 100
  • 167
9
votes
3 answers

Twisted unhandled error

When the twisted reactor is running and an exception occurs within a deferred that isn't caught, "Unhandled Error" is printed to the terminal along with a traceback and the exception. Is it possible to handle/intercept these exceptions (e.g., set a…
All Workers Are Essential
  • 15,826
  • 38
  • 96
  • 129
1
2 3
38 39