title: RabbitMQ/AMQP - Best Practice Queue/Topic Design in a MicroService Architecture
body: <p>We are thinking of introducing a AMQP based approach for our microservice infrastructure (choreography). We do have several services, let's say the customer-service, user-service, article-service etc. We are planning to introduce RabbitMQ as our central Messaging System.</p>
  
  <p>I'am looking for best practices for the design of the system regarding topics/queues etc. One option would be to create a message queue for every single event which can occur in our system, for example:</p>
  
  <pre><code>user-service.user.deleted
  user-service.user.updated
  user-service.user.created
  ...
  </code></pre>
  
  <p>I think it is not the right approach to create hundreds of message queues, isn't it?</p>
  
  <p>I would like to use Spring and these nice annotations, so for example:</p>
  
  <pre><code>  @RabbitListener(queues="user-service.user.deleted")
    public void handleEvent(UserDeletedEvent event){...
  </code></pre>
  
  <p>Isn't it better to just have something like "user-service-notifications" as <em>one</em> queue and then send all notifications to that queue? I would still like to register listeners just to a subset of all events, so how to solve that?</p>
  
  <p>My second question: If I want to listen on a queue which was not created before, I will get an exception in RabbitMQ. I know I can "declare" a queue with the AmqpAdmin, but should I do this for every queue of my hundreds in every single microservice, as it always can happen that the queue was not created so far?</p>