We have two different AMQP servers (RabbitMQ) and configured one binder for each one.
What is the best way to check the connection status to each of the amqp servers?
One way seems to be to use a AmqpTemplate
with CachingConnectionFactory
, where one can configure the host. But is there an easier way?
I also tried to go through List<HealthIndicator>
. But it contains only one RabbitHealthIndicator
when there should be two.
Our config:
spring:
cloud:
stream:
binders:
binder1:
type: rabbit
environment:
spring:
rabbitmq:
host: localhost
port: 5672
password: guest
username: guest
binder2:
type: rabbit
environment:
spring:
rabbitmq:
host: localhost
port: 56721
password: guest
username: guest
So, you have to declare one more RabbitHealthIndicator
for the RabbitTemplate
on the second ConnectionFactory
.