1

I'm scaffolding my backend application and I want to use CQRS and rabbitmq with it (I'm pretty new to rabbitmq). For that, I have specified different vhosts for my prod and dev environments, but I'm not sure how to use exchanges and queues for command, events and query buses.

Should I use just one exchange, named for example CQRS and three different queues for commands, queries and events?

Or maybe should I use three different exchanges (named query_bus, command_bus and event_bus) and inside each one map one queue to every possible command query and event using routing keys?

Thanks!

Levi Ramsey
  • 18,884
  • 1
  • 16
  • 30
Isaac
  • 1,436
  • 2
  • 15
  • 29
  • Why do you need to queue the commands? and queries? any specific reason? – Tore Nestenius May 11 '21 at 06:16
  • These would be async buses, it would help my app performance because large time consuming tasks (queries or commands), could be processed in some other machine for example. My app would just post an specific command or query (DTOs) to this queue and once it's processed it would gather the response if any, or notify it there was an error. – Isaac May 11 '21 at 08:48

1 Answers1

1

You should have separate queues for different content (commands, queries...).

Because then its easier to see if the command or query side is lagging/slow by examining the length of each queue. The queue length gives you nice charts for your dashboard.

Tore Nestenius
  • 16,431
  • 5
  • 30
  • 40