Posts

Showing posts from December, 2016

Introducing Java Reactive Extentions in to a SpringBoot Micro Service

Image
Today I am going to teach you about RxJava, which is a new programming paradigm to do asynchronous programming easily. RxJava stands for Reactive Extensions for Java. Writing a blocking code is evil and deteriorates the performance of your application. So we should focus on writing asynchronous code which never keeps you blocking. There are two approaches to writing asynchronous code, one is using callbacks the other is using RxJava. Callbacks has low composition and lead to callback hell if you have many callbacks back to back. The code becomes more and more complex. That is where RxJava comes to our rescue. RxJava was a project that has been open sourced by the Netflix.




In RxJava Iterators and Iterables become Observers and Observables. Iterable and Iterator is a pull model. In RxJava Observable and Observer is a push model. Push model is preferred over the pull model. You will subscribe to a stream and you will receive notifications. The source will notify you when it emits new item…