Bot using Webflux
Bot using Webflux
- Integrate with Keka – via api/library
- Generic – It will be able to work with any provider/channel with just a little change. (Eg. Whatsapp, telegram, google chat).
- spring-boot and spring-boot-starter for basic Spring Boot application setup
- spring-web flux framework
- reactor-core that we need for reactive streams and also reactor-netty
- spring-boot-starter-data-r2dbc for r2dbc connection
Why was Spring WebFlux created?
Part of the answer is the need for a non-blocking web stack to handle concurrency with a small number of threads and scale with fewer hardware resources. Servlet non-blocking I/O leads away from the rest of the Servlet API, where contracts are synchronous (
Servlet) or blocking (
getPart). This was the motivation for a new common API to serve as a foundation across any non-blocking runtime. That is important because of servers (such as Netty) that are well-established in the async, non-blocking space.
We touched on “non-blocking” and “functional” but what does reactive mean?
The term, “reactive,” refers to programming models that are built around reacting to change — network components reacting to I/O events, UI controllers reacting to mouse events, and others. In that sense, non-blocking is reactive, because, instead of being blocked, we are now in the mode of reacting to notifications as operations complete or data becomes available.
Reactive Streams plays an important role for interoperability. It is of interest to libraries and infrastructure components but less useful as an application API, because it is too low-level. Applications need a higher-level and richer, functional API to compose async logic — similar to the Java 8
Stream API but not only for collections. This is the role that reactive libraries play.
Reactor is the reactive library of choice for Spring WebFlux. It provides the
Flux API types to work on data sequences of 0..1 (
Mono) and 0..N (
Flux) through a rich set of operators aligned with the ReactiveX vocabulary of operators. Reactor is a Reactive Streams library and, therefore, all of its operators support non-blocking back pressure. Reactor has a strong focus on server-side Java. It is developed in close collaboration with Spring.
Spring Data R2DBC, part of the larger Spring Data family, makes it easy to implement R2DBC based repositories. R2DBC stands for Reactive Relational Database Connectivity, a specification to integrate SQL databases using reactive drivers. Spring Data R2DBC applies familiar Spring abstractions and repository support for R2DBC. It makes it easier to build Spring-powered applications that use relational data access technologies in a reactive application stack.
Spring Data R2DBC aims at being conceptually easy. In order to achieve this, it does NOT offer caching, lazy loading, write-behind, or many other features of ORM frameworks. This makes Spring Data R2DBC a simple, limited, opinionated object mapper.
How will it work
- Commands/Terms – Eg. start, birthdays,
- Reactive Programming – use apis
- Personalized message – Hello, User
- List of commands
- Personalized message – Good morning, User
- List of birthdays(if any)
- Leave status (if any)
- Today’s birthdays/events
- Apply for leave
- Integration with keka
- Integration with google calendar