What are we looking for from a design

The first rabbit structure which may come to mind is having an exchange and queue per microservice. With this structure microservices publish to the exchange of the microservice they want to communicate with. ie if you want to send a message to microservice 1 then drop a message on microservice 1's exchange.

pros

cons

  1. Microservices publish to exchanges which are for specific event types without any knowledge of which microservices will pick it up.. eg an exchange of "abc" events and another with "xyz" events.
  2. Queues bind to the exchanges which receives events the microservice is interested in. eg microservices which are interested in "abc" will subscribe to the "abc" exchange.

pros

cons

  1. Every microservice publishes events to the eventbus without any knowledge of which microservices will pick it up.
  2. Microservices can then subscribe to any events on the eventbus by having their queue bind with specific routing.

pros

cons

By creating an inbound and outbound exchange for each microservice then there is full view and control of events from within rabbit itself.

  1. A microservice publishes to an outbound exchange which is solely for that microservice.
  2. The queue of Microservice binds to an inbound exchange which is solely for that microservice.

You can add inbound and outbound exchanges to many different structures, but we are going to add it with the eventbus:

pros

cons

Check out these links for more info:

My design and architecture repo