How does Observables (Rx.js) compare to ES2015 generators?

Observables push changes, and hence the observable, not the function reacting to it, is in control. Generators on the other hand require you to pull values out of them. So the function that will react to the new value determines when it is ready for a new value. I had trouble with backpressure using observables, … Read more

RxJava – fetch every item on the list

Here’s a small self contained example public class Example { public static class Item { int id; } public static void main(String[] args) { getIds() .flatMapIterable(ids -> ids) // Converts your list of ids into an Observable which emits every item in the list .flatMap(Example::getItemObservable) // Calls the method which returns a new Observable<Item> .subscribe(item … Read more

How to get String from Mono in reactive java

Getting a String from a Mono<String> without a blocking call isn’t easy, it’s impossible. By definition. If the String isn’t available yet (which Mono<String> allows), you can’t get it except by waiting until it comes in and that’s exactly what blocking is. Instead of “getting a String” you subscribe to the Mono and the Subscriber … Read more

What’s the difference between Knockout.js and Rx.js?

Steve (the creator of Knockout) explained the difference on his blog: I’m very familiar with Rx for JavaScript, having recently used it heavily on a big project, and in fact aspects of the design of Knockout are made with my Rx experiences in mind. The key difference between Knockout’s implementation of the observer pattern and … Read more

Reactive Programming Advantages/Disadvantages

Well, Reactive Programming means you are doing all your IO bound tasks such as network calls asynchronously. For an instance say your application calls an external REST API or a database, you can do that invocation asynchronously. If you do so your current thread does not block. You can serve lots of requests by merely … Read more

What is PassthroughSubject & CurrentValueSubject

I think we can make analogies with real world cases. PassthroughSubject = A doorbell push button When someone rings the door, you are notified only if you are at home (you are the subscriber) PassthroughSubject doesn’t have a state, it emits whatever it receives to its subscribers. CurrentValueSubject = A light switch Someone turns on … Read more

Java Spring WebFlux vs RxJava

Reactive programming is a programming paradigm, but I wouldn’t call it new. It’s actually been around for a while. Just like object-oriented programming, functional programming, or procedural programming, reactive programming is another programming paradigm. Paradigm is defined by Reactive Manifesto Reactive Streams, on the other hand, is a specification. For Java programmers, Reactive Streams is … Read more

Spring 5 WebClient using ssl

Looks like Spring 5.1.1 (Spring boot 2.1.0) removed HttpClientOptions from ReactorClientHttpConnector, so you can not configure options while creating instance of ReactorClientHttpConnector One option that works now is: val sslContext = SslContextBuilder .forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE) .build() val httpClient = HttpClient.create().secure { t -> t.sslContext(sslContext) } val webClient = WebClient.builder().clientConnector(ReactorClientHttpConnector(httpClient)).build() Basically while creating the HttpClient, we are … Read more

Subscribewith Vs subscribe in RxJava2(Android)?

Observable#subscribe explanation: In your first code snippet: .subscribe(this::handleResponse, this::handleError)); You are actually using one of the several overloaded Observable#subscribe methods: public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) There is another one that also takes in an Action to perform onComplete: public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)