Reactive programming(using Spring webFlux) Flashcards

1
Q

Webflux vs MVC

A

A reactive, non-blocking stack for dealing with Restful services and client in a non blocking way
MVC uses the Servle tehcnology in a blocking way?
But they both use similar annotations
Webflux uses reactive types (Mono and FLux???)
* it uses different error handling
Spring Reactive web(uses Netty) vs Spring Web(uses Tomcat) dependencies form spring.io

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Reactive programming

A

an asyncronious programming paradigm focused on processing streams of data
*reactive programs work in response to external demands and mostly deal with accurete interupt handling. Real time programs are ususally reactive.
Use case:
External Service Calls
Highly Concurent Message Consumers
SpreadSheets
AbstractionOver Async Processing?
Abstract whether the program si asyn or not?

Features
Data streams
Asyncronious
Non-Blocking
Backpressure
Failure as messages!!!!

Blocking vs NonBlocking
NonBlocking code will process advailable data, will ask to be notified when more is available then continue

Reactive Stream API –> java 9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

R2BDC

A

Reactive Relational Database Connectivity, a specification to integrate SQL databases using reactive drivers
https://spring.io/projects/spring-data-r2dbc
Spring Data R2DBC dependecy STARTER offers support for an array of different databases: H2, MariaDB, Microsoft SQL Server, MySQL, jasync-sql MySQL, Postgres and Oracle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Reactive entities

A

extend ReactiveCrusdRepository that defines methods to save and retroive data from the database usinf the below 2 reactive entity types:
Mono –> 0 or 1
Flux –> 0 or many

!!!!you need to call subscribe method on Mono or FLux otherwise that operations done on them will not excute!! THe need to be backfired with the subscribe method? ???

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Reactive client for consuming rest services

A

is done with the reactive client: WebClient (oppesite being RestTemplate)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly