Going Reactive with Rabbit in Java

Stefano Troìa
The Startup
Published in
4 min readNov 15, 2019

--

Photo by Denys Nevozhai on Unsplash

When building an application based on real-time data streams, it’s fundamental to have a highly responsive system that can handle the highest number of messages. The most common choice is to use a producer-consumer solution using messages broker like Rabbit.

These types of solutions are cloud-based with numerous consumers ready to scale if the load in the queue grows too much.
The difficult part comes when we want this to land in private networks where the number of resources is very limited, for example, we want to build a system for real-time monitoring of IoT devices and collecting their data in place.

What is our goal?

We want to increase the number of messages that a consumer can handle in a second, considering we have few resources and thousands of messages per second pushed in a queue. Considering the problem takes place when we aren’t in a scalable environment.

Before to get started

  • prefetch-count: the max number of messages a consumer can pick at once from the queue.
  • ACK: the message sent by the consumer to Rabbit, saying “it’s all OK you can remove this message from the queue”, it’s not compulsory you can create a queue that doesn’t wait for a consumer ACK.

--

--