Answer the question
In order to leave comments, you need to log in
How to organize dynamic addition of consumers for rabbit-mq?
So the task. There is a server, two instances of one process
(consumer) are spinning inside, which does the hard work, receiving the rabbitmq command. If you run more than 2 instances inside one server, everything stops working at all. And so on, until the pool of virtual machines runs out.
Has anyone solved something similar?
Is it possible to solve this with the help of rabbitmq?
Answer the question
In order to leave comments, you need to log in
I would make an intermediate consumer who would simply rake out the queue and watch what is available on free resources. If there is an opportunity (there is a free process or it is possible to raise a new virtual machine and thereby provide a free process) - put it in another queue, where the message will be received by the consumer who performs the real task. For each process, you can organize a separate topic exchange queue for each process on the virtual machine.
If the intermediary worker sees that there are no free processes and there is no way to raise the virtual machine, return the message to the queue (you can use the delayed queue).
Several consumers (consumers) can be connected to the queue in RabbitMQ at the same time, but RabbitMQ itself has nothing to do with their scaling. You can understand that the current consumers are not coping with their task by analyzing the size of the queue (the number of messages in it). The very task of scaling, most likely, needs to be solved at the level of some kind of container virtualization (for example, docker), it will be easier and faster.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question