0
votes

I am trying to get a better understanding of using topic exchanges with multiple consumer in pub-sub model. Lets say I have

  • Single durable queue called Log
  • Publisher topic exchange which routes all log messages (Log.#) to this queue "Log"

Can I have multiple consumer who read log messages from the above publisher queue "Log" based on routing key. e.g., consumer C1 - gets on only Log.x messages, C2 gets Log.y messages .. and so on.

In short is it possible to have multiple consumer reading from the same queue but getting only filtered messages OR each consumer has to have its own topic based queue?If answer is latter, each consumer has its own queue based on distinct topic then how can publisher send independently of consumer queue. Thanks!

1

1 Answers

0
votes

You can't have consumers C1 and C2 on the same queue and each getting a different subset of messages based on a routing key. Instead, what you want is an exchange that publishes to 2 different queues based on the routing key. Then C1 and C2 each read from their own queues.