Developing reactive microservice using Springboot 2 - Bytesville
Reactive Spring is based on the project reactor for building non-blocking applications using the spring platform and spring cloud frameworks. Three important interfaces available in Reactor are Publisher, Subscriber, and Processor. Publisher – source of the data Subscriber – One which receives data asynchronously Processor – nothing but a publisher which is also a subscriber (most of the time we won’t need this) Reactor introduces reactive types which implement the Publisher interface namely Flux and Mono. Flux – represents multiple sequences of a result 0…N (many items) which suggests Flux is a standard publisher Mono – As the name suggests, represents single sequence of a result either an empty result or one result 0…1 which suggests Mono will emit at most one item Starting from Spring 5 and Spring Boot 2 reactive core is completely supported and provides an excellent long-awaited alternative to Akka Streams. If you are coming from a spring background and uses it extensively there is no reason why you shouldn’t try this. However, it is great for people who begin with Spring platform as well. This post is hugely inspired by Josh Long’s webinar on Reactive streams which you can find here. We are going to