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
89
votes
3 answers

How to get data from observable in angular2

I am trying to print the result of http call in Angular using rxjs Consider the following code import { Component, Injectable, OnInit } from '@angular/core'; import { Http, HTTP_PROVIDERS } from '@angular/http'; import…
testing
  • 2,303
  • 4
  • 20
  • 32
89
votes
3 answers

What's the status of current Functional Reactive Programming implementations?

I'm trying to visualize some simple automatic physical systems (such things as pendulum, robot arms,etc.) in Haskell. Often those systems can be described by equations like df/dt = c*f(t) + u(t) where u(t) represents some kind of 'intelligent…
mnish
  • 1,869
  • 1
  • 13
  • 15
87
votes
4 answers

RxJS - observable doesn't complete when an error occurs

When I create an observable from scratch, and have the observer error, then complete, the done part of the subscription never is invoked. var observer = Rx.Observable.create(function(observer){ observer.onError(new Error('no!')); …
Oved D
  • 7,132
  • 10
  • 47
  • 69
87
votes
1 answer

Node.js Streams vs. Observables

After learning about Observables, I find them quite similar to Node.js streams. Both have a mechanism of notifying the consumer whenever new data arrives, an error occurs or there is no more data (EOF). I would love to learn about the…
urish
  • 8,943
  • 8
  • 54
  • 75
85
votes
2 answers

Chaining Observables in RxJS

I'm learning RxJS and Angular 2. Let's say I have a promise chain with multiple async function calls which depend on the previous one's result which looks like: var promiseChain = new Promise((resolve, reject) => { setTimeout(() => { …
Harindaka
  • 4,658
  • 8
  • 43
  • 62
77
votes
5 answers

Mono vs Flux in Reactive Stream

As per the documentation: Flux is a stream which can emit 0..N elements: Flux fl = Flux.just("a", "b", "c"); Mono is a stream of 0..1 elements: Mono mn = Mono.just("hello"); And as both are the implementations of the Publisher…
KayV
  • 12,987
  • 11
  • 98
  • 148
76
votes
9 answers

How to mock Spring WebFlux WebClient?

We wrote a small Spring Boot REST application, which performs a REST request on another REST endpoint. @RequestMapping("/api/v1") @SpringBootApplication @RestController @Slf4j public class Application { @Autowired private WebClient…
Roman
  • 763
  • 1
  • 5
  • 5
75
votes
2 answers

What is difference between observer pattern and reactive programming?

Recently I heard the term reactive programming a lot, but when I searched for it, what I discovered was only some similarities with observer pattern. Actually, I cannot find any differences between them. What's conceptual difference between them and…
eonil
  • 83,476
  • 81
  • 317
  • 516
72
votes
4 answers

Hot and Cold observables: are there 'hot' and 'cold' operators?

I reviewed the following SO question: What are the Hot and Cold observables? To summarize: a cold observable emits its values when it has an observer to consume them, i.e. the sequence of values received by observers is independent of time of…
user3743222
  • 18,345
  • 5
  • 69
  • 75
69
votes
9 answers

How to customize SpringWebFlux WebClient JSON deserialization?

I'm using a spring-webflux WebClient (build 20170502.221452-172) to access a Web application producing a stream of Entry objects (application/stream+json) like this: final WebClient producerClient =…
Martin
  • 766
  • 1
  • 5
  • 8
69
votes
5 answers

How is reactive programming different than event-driven programming?

I am learning reactive programming and functional reactive programming in JavaScript. I am very confused. Wikipedia says that there are various ways to write reactive code such as imperative, OORP and functional. I want to know if event-driven is…
Narayan Prusty
  • 2,501
  • 3
  • 22
  • 41
68
votes
2 answers

Simple way to get the current value of a BehaviorSubject with rxjs5

Previously in rxjs4 there was a method in the BehaviorSubject called: getValue() (doc here). This method does not exist anymore in rxjs5. So the only solution that I found to get the value of a BehaviorSubject was: let…
Clement
  • 3,860
  • 4
  • 24
  • 36
66
votes
2 answers

Convert Observable> to a sequence of Observable in RxJava

Given a list of cars (List cars), I can do: Observable.just(cars); //returns an Observable that emits one List Observable.from(cars); //returns an Observable that emits a squence of Car Is there a way I can go from an Observable of a…
Giorgio
  • 13,129
  • 12
  • 48
  • 75
62
votes
2 answers

Mono switchIfEmpty() is always called

I have two methods. Main method: @PostMapping("/login") public Mono> loginUser(@RequestBody final LoginUser loginUser) { return socialService.verifyAccount(loginUser) .flatMap(socialAccountIsValid ->…
61
votes
3 answers

How to override the width of a TextField component with Material UI?

I'm trying to reduce the width of the TextField component : Here is the render method: render() { return (
Nicolas Henin
  • 3,244
  • 2
  • 21
  • 42