reactive-programming

Difference between catch: and subscribeError:

99封情书 提交于 2019-12-03 04:00:41
问题 In ReactiveCocoa, what's the difference between the subscribeError: method vs. catch: ? Why would you want to return a signal in catch: ? 回答1: -subscribeError: actually subscribes: this is the end of the line. Whereas -catch: simply transforms a signal into a new signal (and doesn't actually subscribe). Think of the signal like a program. When you -subscribeError: , you are telling the computer "I want to run this program, but I only want to hear back from you if it errors out." When you

Benefits of having HTTP endpoints return Flux/Mono instances instead of DTOs [closed]

天大地大妈咪最大 提交于 2019-12-03 03:43:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 11 months ago . I've watched Spring Tips: Functional Reactive Endpoints with Spring Framework 5.0 and read a little about spring reactor but I can't quite understand it. What are the benefits of having endpoints return Flux / Mono instances (jacksonified) instead of straight up dto objects

Comparison of Java reactive frameworks [closed]

限于喜欢 提交于 2019-12-03 03:37:57
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I see many frameworks/libraries that claim that they can help build reactive applications in Java, such as: Akka, Vert.x, RxJava, Reactor, QBit, etc. They seem to have different approaches, features, pros, cons, etc. I could not find detailled comparisons. There is

Convert Observable<List<Car>> to a sequence of Observable<Car> in RxJava

喜你入骨 提交于 2019-12-03 03:25:45
问题 Given a list of cars ( List<Car> cars ), I can do: Observable.just(cars); //returns an Observable that emits one List<Car> Observable.from(cars); //returns an Observable that emits a squence of Car Is there a way I can go from an Observable of a List<Car> to a sequence of Observable<Car> ? Something like a from without parameters Obserable.just(cars).from() 回答1: You can map an Observable<List<Car>> to Observable<Car> like so: yourListObservable.flatMapIterable(x -> x) Note that flatMapping

When to use RACReplaySubject vs. RACMulticastConnection?

跟風遠走 提交于 2019-12-03 03:18:31
问题 Using ReactiveCocoa, there seem to be two ways to have subscribers receive the same values from a signal, rather than re-triggering whatever operation generates those values: Via RACReplaySubject or RACMulticastConnection. Here are the header docs for RACReplaySubject: A replay subject saves the values it is sent (up to its defined capacity) and resends those to new subscribers. It will also replay an error or completion. And for RACMulticastConnection: A multicast connection encapsulates the

How is ReactiveMongo implemented so that it is considered non-blocking?

帅比萌擦擦* 提交于 2019-12-03 03:11:08
Reading the documentation about the Play Framework and ReactiveMongo leads me to believe that ReactiveMongo works in such a way that it uses few threads and never blocks. However, it seems that the communication from the Play application to the Mongo server would have to happen on some thread somewhere . How is this implemented? Links to the source code for Play, ReactiveMongo, Akka, etc. would also be very appreciated. The Play Framework includes some documentation about this on this page about thread pools . It starts off: Play framework is, from the bottom up, an asynchronous web framework.

Subscribewith Vs subscribe in RxJava2(Android)?

倖福魔咒の 提交于 2019-12-03 01:38:10
问题 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, this::handleError)); VS compositeDisposable.add(get() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) // .subscribe(this::handleResponse, this::handleError); .subscribeWith(new DisposableObserver<News>() { @Override public void onNext(News

C# .NET Rx- Where is System.Reactive?

爱⌒轻易说出口 提交于 2019-12-03 01:09:30
I have an intensive Java background so forgive me if I'm overlooking something obvious in C#, but my research is getting me nowhere. I am trying to use the reactive Rx .NET library. The compiler is not complaining about the IObservable but it is with the call to the zip method. It is throwing the "... are you missing a using directive or assembly reference?" I've been going through the namespaces and I cannot find what is looking for. I cannot find the System.Reactive which also throws an error if used, and all the references are already included for this Windows 8.1 app. Can someone please

Reactive Programming - RxJS vs EventEmitter in Node.js

痴心易碎 提交于 2019-12-03 00:47:30
问题 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 subsequent node libraries like "cluster" help you to get best out of your multi-core machine. And Node.js also provides you the EventEmitter functionality where you can subscribe to events and act upon it asynchronously. On the other hand if I understand

Web Reactive Programming - What are the advantages from the HTTP client point of view?

寵の児 提交于 2019-12-02 23:11:33
Lets suppose these two scenarios of a controller that generates some random numbers with a delay: 1) Reactive Spring 5 reactive application: @GetMapping("/randomNumbers") public Flux<Double> getReactiveRandomNumbers() { return generateRandomNumbers(10, 500); } /** * Non-blocking randon number generator * @param amount - # of numbers to generate * @param delay - delay between each number generation in milliseconds * @return */ public Flux<Double> generateRandomNumbers(int amount, int delay){ return Flux.range(1, amount) .delayMillis(delay) .map(i -> Math.random()); } 2) Traditional Spring MVC