0

I have built a rabbitmq wrapper which publishes messages to consumers and this is working well.

Can I also build a work queue (like gearman) in rabbitmq which can distribute long running tasks to consumers and the consumers, in turn, notify the publisher with the results.

I guess this would require the publisher to act as a consumer as well which I am not sure how to implement. (Please correct me if I am wrong).

Or, is rabbitmq just not the tool for such case.

Thanks,

web-nomad
  • 6,003
  • 3
  • 34
  • 49
  • It may be overkill, but [Kafka](https://kafka.apache.org/) is pretty good at doing what you're describing. – Chad Apr 27 '15 at 18:28

1 Answers1

2

RabbitMQ supports this type of pattern. Have a look at the RPC tutorial for a bootstrap of how to implement this pattern.

It can be implemented in different way depending of your needs:

  • direct reply queue, queue will be created and used only for the reply associated to the request
  • static reply queue which will contain all the replies

It usually implies a correlation id to correlate request with the reply, or it can be stateless if the reply contains all the necessary information.

It really depends on your needs.

Nicolas Labrot
  • 4,017
  • 25
  • 40