Questions tagged [reactive-programming]

Reactive Programming is a programming paradigm oriented around data flows and the propagation of change.

Wiki

Reactive programming is a programming paradigm oriented around data flows and the propagation of change.

This means that it should be possible to express static or dynamic data flows with ease in the programming languages used, and that the underlying execution model will automatically propagate changes through the data flow.


Examples

In a Model-view-controller architecture, reactive programming can allow changes in the underlying model to automatically be reflected in the view, and vice versa.

Unlike Dataflow programming, reactive programming paradigm includes automatic update of variables if variables are dependent on other variables.


Related tags

5669 questions
61
votes
5 answers

Comparing core.async and Functional Reactive Programming (+Rx)

I seem to be a little bit confused when comparing Clojure's core.async to the so called Reactive Extensions (Rx) and FRP in general. They seem to tackle similar problem of async-hronicity, so I wonder what are the principal differences and in what…
tillda
  • 18,150
  • 16
  • 51
  • 70
59
votes
2 answers

How do I use Reactor's StepVerifier to verify a Mono is empty?

I am using StepVerifier to test values: @Test public void testStuff() { Thing thing = new Thing(); Mono result = Mono.just(thing); StepVerifier.create(result).consumeNextWith(r -> { assertEquals(thing, r); …
Mark
  • 4,970
  • 5
  • 42
  • 66
58
votes
1 answer

Backpressure mechanism in Spring Web-Flux

I'm a starter in Spring Web-Flux. I wrote a controller as follows: @RestController public class FirstController { @GetMapping("/first") public Mono getAllTweets() { return Mono.just("I am First Mono") } } I know…
Sam
  • 6,770
  • 7
  • 50
  • 91
56
votes
1 answer

Threading model of Spring WebFlux and Reactor

Currently experimenting reactive programming with Spring 5.0.0.RC2, Reactor 3.1.0.M2 and Spring Boot 2.0.0.M2. Wondering about the concurrency and threading model used by WebFlux and Reactor to properly code the application and handle the mutable…
56
votes
2 answers

RxJava Fetching Observables In Parallel

I need some help in implementing parallel asynchronous calls in RxJava. I have picked up a simple use case wherein the FIRST call fetches (rather searches) a list of products (Tile) to be displayed. The subsequent calls go out and fetch (A) REVIEWS…
diduknow
  • 1,624
  • 2
  • 13
  • 10
56
votes
2 answers

Reactive Programming - RxJS vs EventEmitter in Node.js

Recently I've started looking at RxJS and RxJava(from Netflix) libraries which work on the concept of Reactive Programming. Node.js works on the basis of event loops, which provides you all the arsenal for asynchronous programming and the…
53
votes
6 answers

What is PassthroughSubject & CurrentValueSubject

I happen to look into Apple's new Combine framework, where I see two things PassthroughSubject CurrentValueSubject Can someone explain to me what is meaning & use of them?
Nasir
  • 1,617
  • 2
  • 19
  • 34
53
votes
6 answers

Spring 5 WebClient using ssl

I'm trying to find examples of WebClient use. My goal is to use Spring 5 WebClient to query a REST service using https and self signed certificate Any example?
Seb
  • 3,602
  • 8
  • 36
  • 52
52
votes
1 answer

Can I use SpringMvc and webflux together?

I would like to use 2 approaches(reactive and standard) in one project. I tried to migrate one REST API endpoint to reactive webflux and test performance before migrate rest of them. But it didn't work. I added router and handler for him, but until…
52
votes
1 answer

Subscribewith Vs subscribe in RxJava2(Android)?

When to call the subscribeWith method rather than plain subscribe? And what is the use case? compositeDisposable.add(get() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(this::handleResponse,…
bastami82
  • 5,955
  • 7
  • 33
  • 44
51
votes
3 answers

Java Spring WebFlux vs RxJava

I’m starting to learn reactive programming in Java. The whole reactive paradigm is new to me. In my learning process, i have come across few terms/libraries such as Spring WebFlux, projectreactor, and RxJava. I hope someone can explain what the…
51
votes
2 answers

Mono vs CompletableFuture

CompletableFuture executes a task on a separate thread ( uses a thread-pool ) and provides a callback function. Let's say I have an API call in a CompletableFuture. Is that an API call blocking? Would the thread be blocked till it does not get a…
XYZ
  • 709
  • 2
  • 9
  • 12
50
votes
6 answers

Reactive Programming Advantages/Disadvantages

I keep studying and trying Reactive Style of coding using Reactor and RxJava. I do understand that reactive coding makes better utilization of CPU compared to single threaded execution. Is there any concrete comparison between reactive programming…
prranay
  • 1,789
  • 5
  • 23
  • 33
50
votes
11 answers

RxJS distinctUntilChanged - object comparison

I have a stream of objects and I need to compare if the current object is not the same as the previous and in this case emit a new value. I found distinctUntilChanged operator should do exactly what I want, but for some reason, it never emits value…
Daniel Suchý
  • 1,822
  • 2
  • 14
  • 19
48
votes
7 answers

How to get String from Mono in reactive java

I have a method which accepts Mono as a param. All I want is to get the actual String from it. Googled but didn't find answer except calling block() over Mono object but it will make a blocking call so want to avoid using block(). Please suggest…
nanosoft
  • 2,913
  • 4
  • 41
  • 61