1
votes

I've recently been playing around with Spring Webflux and it looks extremely useful and efficient. Also, reading about Reactive Systems, it seems like one of the defining traits of such systems is that they are message-driven.

Came across this post on the web: https://www.captechconsulting.com/blogs/annotation-driven-reactive-web-apis-with-spring-webflux

This post also mentions,

Spring WebFlux contains support for Reactive HTTP Rest API(s), WebSocket applications, and Server-Sent Events. Spring WebFlux is responsive, resilient, scalable, and message-driven.

My question is that if a write a simple REST API, much like the post describes, performing CRUD operations backed by a MongoDB and using spring-boot-starter-data-mongodb-reactive, could I call my API service message-driven? I could also potentially add a Webclient to talk to some downstream services.

Does message driven in the context of a REST API even make sense?

1
I do think that if we are treating the REST service calls and the results from a DB as "event" Data Streams and my API is responding to those when it returns the final result to the user, then perhaps this system qualifies as message/event-driven?vksinghh

1 Answers

0
votes

No, your application is not message-driven instead your application are Reactive. Reactive applications is event-driven, non-blocking, scalable, resilient and elastic. It supports Publisher and Subscriber mechanism, means asynchronous communication is being done between Publisher and Subscriber. It supports two types of Publishers

  1. Mono: Used when we produce only one item.
  2. Flux: Used when we produce multiple items.

To make your application message-driven, you need to use any message broker like Kafka, RabbitMQ etc.