1

I'm working on a microservice-based application. It is built of ca. 30 microservices and as usually some of them communicate with each other over RabbitMQ.

Such services have names of exchanges, queues and routing keys in their configuration file (application.yml). All the corresponding beans (bindings included) are created in a @Configuration. All of them are created automatically on service startup.

As it's a startup project it's characterized by lots of changes in design, renaming of exchanges, routing keys, queues etc.

Therefore it would be great to have a central place where all the necessary bindings could be managed. So you would have to rename an exchange and/or routing key in one place. The other advantage is transparency - one text file contains information about what services depend on what exchanges.

The configuration of such a management component could look like:

services:
    service1: s1
        binding1:
            exchange: e1
            queue1: s1q1
            routing-key: rk1
        binding2:
            exchange: e1
            queue1: s1q2
            routing-key: rk2
        ...
    service2: s2
        binding1:
            exchange: e2
            queue1: s2q1
            routing-key: rk3
        binding2:
            exchange: e2
            queue1: s2q1
            routing-key: rk4
        ...
    ...

And the configuration of service1 could just contain queue names:

config:
    queue1: s1q1
    queue2: s1q2
...

The services would create queues only and the management component - exchanges and bindings.

I'm thinking about creating additional service whose only purpose would be the creation of the bindings. However I'm not sure whether I wouldn't reinvent the wheel.

Is there such a utility (maybe RabbitMQ plugin) that solves this?

ka3ak
  • 2,435
  • 2
  • 30
  • 57
  • Have you looked at spring-clound-config for centralizing your configuration? https://spring.io/projects/spring-cloud-config – Gary Russell Nov 29 '21 at 15:30
  • @GaryRussell Doesn't it just hold the configuration? But I want to move exchange/binding creation out of the services. They should only know what queues to create and how. However queue creation can possibly be delegated either. – ka3ak Nov 29 '21 at 15:41

0 Answers0