Scaling up/down my microservice which is listening to multiple queues

Viewed 382

I have to build a microservice that will listen to multiple queues, read the messages, and insert them into a database. There can be 1000's queues. If anyone can help what will be the best and clean way to scale up and down the service. How can I pass the queues name dynamically using docker and for example, service1 would only listen to queue1 and queue2 whereas after load increases another instance of the service is up which will listen to queue3 and process its messages? Each queue is independent and should be processed in an ordered way. Basically, you can consider having if we have 100 customers we will have 100 queues. Sometimes the queues for one customer get more messages for that case If we can spawn a new instance and separate that customer id queue to be processed on a different service that will be faster for that customer. As the load decreases one service can process all the queues. Also, is there any way to dynamically pass the queues to listen/remove from the binding for a service without restarting?

enter image description here

0 Answers
Related