2. Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Respect Knolx session timings, you
are requested not to join sessions
after a 5 minutes threshold post
the session start time.
Feedback
Make sure to submit a constructive
feedback for all sessions as it is
very helpful for the presenter.
Silent Mode
Keep your mobile devices in silent
mode, feel free to move out of
session in case you need to attend
an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
3. Agenda
01 What is Reactive Programming?
02 When to use Reactive Programming?
03 Components of Reactive Programming
04 Reactive Principles
05 Features of Reactive Programming
06 Demo
4. What is Reactive Programming
● Reactive programming describes a design
paradigm that relies on asynchronous
programming logic to handle real-time
updates to otherwise static content.
● It provides an efficient means - the use of
automated data streams to handle data
updates to content whenever a user makes
an inquiry.
● Reactive programming creates software
that responds to events rather than solicits
inputs from users.
To understand in simple terms, Reactive Programming can be represented in the following way:
RP = Observable + Observer + Schedulers
5. Functional style code Vs Rest code
Traditional RestAPI Code
Reactive Program functional style code
6. Flux and Mono
● It implements the Publisher interface and, it is just a reactive stream that pushes elements
whenever the subscriber instructs it to do so. It returns 0 to 1 element.
Mono<String> mono = Mono.just("Knoldus");
Mono<String> mono = Mono.empty();
● Mono is a special case in which the reactive stream will either emit only one item or none. It
contains a different set of methods to, for instance, concatenate Mono streams into a Flux. It
returns 0 to N elements.
Flux<String> flux = Flux.just("A", "B", "C");
Flux<String> flux = Flux.fromArray(new String[]{"A", "B", "C"});
Flux<String> flux = Flux.fromIterable(Arrays.asList("A", "B", "C")
8. When to use Reactive Programming?
One of the most common use-case for using RP is when you need handling of
asynchronous data streams. I am going to mention some real-world applications where
Reactive Programming is being used presently.
● Developing mobile applications using Reactive Programming.
● Reactive Programming in the Netflix API with RxJava
● Going reactive provides an elegant solution when it comes to specific types of
high-load or multi-user applications.
○ Social networks, chats
○ Games
○ Audio and video apps (more so in streaming)
9. Component of Reactive Programming?
The picture below demonstrates how reactive programming works.
10. Three major component of Reactive Programming are:
1. Producers
2. Consumers
3. Data pipeline
1. Producers:
Producers are the source of your data. A stream must always have a producer of data,
which will be the starting for any logic that you will perform in RxJS.
2. Consumers:
Consumers are the components that accept events from the producer and process them
in some way. When the consumer begins listening to the producer for events, you now
have a stream. It is at this point that the stream begins to push events; we’ll refer to a
consumer as an observer.
3. Data Pipeline:
The biggest benefit of reactive programming is you can edit the data as it passes from
producer to consumer.
12. Features of Reactive Programming?
● Provide better control over the response times associated with the processing of
events.
● Enable consistency in software design for real-time systems, to reduce development
and maintenance costs and effort.
● Support load balancing and resiliency to improve quality of experience.
● Make the concept of a stream or event flow explicit, improving overall management of
compute elements and processing resources by making them more "visual".