1

i am trying to implement support for multi tenant spring boot application where each tenant application is sending data to the spring boot application via RabbitMq. Each tenant is connected to its own RabbitMq virtual host. This could be shown in the figure below enter image description here

This problem has been asked many times such as

  1. How to use multiple vhosts in a Spring RabbitMQ project?
  2. configuring multiple Vhosts in AMQP in rabbitmq configuration spring boot
  3. RabbitMQ RPC across multiple rabbitMQ instances

The solution seems to be creating multiple connectionFactory beans for each virtual host. These are completely hard coded solutions. I want something more manageable.

In my case, the exchange name and binding keys are same for each virtual host. So far the spring boot application is able to connect to one virtual host.

I want my spring boot application to handle all those virtual hosts along with the required credentials to be done in the spring profile rather than creating a seperate bean for each connection factory.

Is there a way to implement support for multiple vhosts in spring profile or if possible is there any other better way to solve this problem which I along with many other developers are facing?

Thanks

user2083529
  • 529
  • 2
  • 11
  • 22
  • https://stackoverflow.com/questions/53497244/spring-cloud-streams-rabbitmq-multi-binder-vs-the-shovel-plugin-application – kinjelom Jun 24 '19 at 14:05

1 Answers1

4

There is an open issue to add this functionality. The author already has a project spring-multirabbit which might satisfy your needs.

Gary Russell
  • 131,626
  • 14
  • 99
  • 125