axon rabbitmq configuration

can somebody please point me to documentation or show me some example how to properly configure axon to publish messages to rabbit?
I was searching the forum and found this thread!searchin/axonframework/rabbitmq|sort:date/axonframework/7c-k-U7tQtc/8OWjyvq5AgAJ but the configuration seems to be from older releases of axon. I need configuration with exchange creation.

When I want to consume events from rabbit I can configure something like this:

public SpringAMQPMessageSource objectTypeEventsSource(Serializer serializer) {
   return new SpringAMQPMessageSource(new DefaultAMQPMessageConverter(serializer)) {

      @RabbitListener(queues = "objectTypeLocalizationQueue")
      public void onMessage(Message message, Channel channel) throws Exception {
         super.onMessage(message, channel);

Do I need also create bindings for this e.g something like bellow or will axon autoconfigure that for me if I supply property

public Queue queue() {
   return QueueBuilder.durable("objectTypeLocalizationQueue").build();

public Exchange exchange() {
   return ExchangeBuilder.fanoutExchange("").durable(true).build();

public Binding binding() {
   return BindingBuilder.bind(queue()).to(exchange());

public void configure(AmqpAdmin admin) {

Also how are you guys configuring the exchanges when you have multiple distributed processors of same type (separate microservices) and the same database (with same schema -> I know that this is not good from microservices point of view, but …) I don’t want to have one message to be consumed by all processor of same type.

When I publish message to rabbit does it mean that my “local” event handlers are consuming messages from rabbit or my local listeners still consume messages from “local event bus”?
I’m just trying to understand how to configure rabbit for multiple microservices. If somebody can share some good stuff where to learn more about configuring exchanges/queues it would be very helpful.


To enable amqp support, you need to add “” in your
The mq will delivery messages to the related EventHandler. If you have multiple handlers listening on the same events, it depends on your mq strategy to determine which one will receive and handle the events.

在 2017年3月31日星期五 UTC+8下午8:47:20,Lukáš Vasek写道:

Actually, it is:[exchange name].
This will have the autoconfiguration define a component that forwards all events to the mentioned Exchange.

You’re responsible for defining (and creating) the exchanges, queues and bindings yourself.