I have two Services Producer and Consumer (both spring-boot) running on different servers. The idea is to produce aggregated data from multiple sources and publishing messages. The consumer then listens to them and does some processing.
I am using RabbitMQ between these services. The problem is sending messages at 20K/s in dynamic bursts (30-second burst + 3-4 seconds idle). The consumer is working around 10-15K/s. Due to this, there is a congestion and messages are getting piled up in RabbitMQ.
I cannot horizontally scale the system due to some constraints on Consumer. So I want to slow down the publishing rate depending on the consumption rate dynamically. This is critical as there is a requirement to add another producer in near future . I am using a common Redis and MongoDB and can use them for implementing this. I've heard of Back pressure, but never built anything using that. Can that help? Please suggest an approach. Thank you.
PS : I have read this and solutions present there do not work for me.