0

I have tasks with an ids, and each task has some amount of jobs to do:

  • every job for each user;
  • for each task, number of users and jobs are different.

And I want to put all the jobs to one queue with name task{id}, so I can control when the task is done (by empty queue task{id}), and automatically delete it with rabbitMQ help, and control a number of consumers working on one task{id}.

And I want my consumers works all the time like daemons and choose the queues with jobs automatically to work with.

The main question here is how to get name of a task inside a consumers to bind them to it? Or maybe there can be some another trick with rabbitMQ to do so, without knowing name of a queue?

Sergey Nikolaev
  • 685
  • 1
  • 6
  • 16

1 Answers1

0

You need to use the Event Exchange Plugin , this plugin allows you to consumes internal events and re-publishes them to a topic exchange, thus exposing the events to clients (applications).

You can bind to queue.created Event which will give you the name of the queue in the message header and you can then use it to bind your consumer to that specific queue

Soumen Mukherjee
  • 2,953
  • 3
  • 22
  • 34