Does the producer constantly work with consumers through the message queue?

I have a producer whom I want to constantly distribute work among consumers by means of consecutive hashing. For example, with consumer nodes X and Y, tasks A, B, C should always go to consumer X and D, E, F to consumer Y. But this can change slightly if Z joins the consumer pool.

I did not want to deal with writing my own logic to connect to consumer nodes, and especially not with managing nodes connecting and leaving the pool, so I went the way of using RabbitMQ and an exclusive queue to the consumer node.

One of the problems I ran into is listing these queues, as the manufacturer must know all the available queues before the work is distributed. AMQP does not even support listing queues, which makes me uncertain about my whole approach. RabbitMQ and Alice ( broken at the moment ) add this functionality though: Is there an API for listing queues and exchanges for RabbitMQ?

Is it a wise use of Rabbit? Should I use message queue at all? Is there a better design, so the line can consistently share my work among consumers, instead of what I need?

+5
source share
1

, , RabbitMQ.

:

  • ; constant_divider;
  • , , .
  • (, rabbitmqctl list_consumers), , ; , ;
  • , , .

, 6 : A, B, C, D, E, F C1 C2, : C1 3 A, B C; C2 3 c_d D, E F.

C3 , .

, routing_keys A, B, C, D, E / F, .

:

  • , , ; , , , , , (, C3 , , C2 - E F, )
  • - , ( ) ; .

, , , , RabbitMQ - , (, " " ) AMQP.

+6

All Articles