docker run -d --hostname rabbitNode1 --name rabbit1 --add-host rabbitNode2:10.1.2.3 -p "4369:4369" -p "5672:5672" -p "15672:15672" -p "25672:25672" -p "35197:35197" -v "/home/user/rabbitmq-3:/var/lib/rabbitmq/mnesia/" -e "RABBITMQ_USE_LONGNAME=true" -e RABBITMQ_ERLANG_COOKIE="cooky" rabbitmq:3-management
docker exec rabbit1 rabbitmqctl stop_app
docker exec rabbit1 rabbitmqctl join_cluster rabbit@rabbit2
docker exec rabbit1 rabbitmqctl start_app
The cluster was created successfully. But issues started to show up. First, the rabbitMQ web admin module loads very slowly. There is a significant lag time when loading the different pages within the admin module.
The second was using Springboot's AMQ implementation to connect to the rabbitMQ cluster. The code snippet is:
@Bean
protected Queue ackToProducerQueue() {
return new Queue(this.queueName, true);
}
@Bean
protected Binding bindAckToProducerQueue(Queue ackToProducerQueue, TopicExchange exchange) {
return BindingBuilder.bind(ackToProducerQueue).to(exchange).with(this.queueName);
}
@RabbitListener(queues = "#{ackToProducerQueue.name}")
@Override
protected void receiveMessage(DiodeBrokerMessage message) {
LoggerUtil.info(this.getClass(), "Message at " + queueName);
processMessage(message, outboxPath);
}
This produced the following connection exception:
The code exception appears only when trying to connect to the RabbitMQ cluster. On a single instance of RabbitMQ, the code works. The same occurs for the RabbitMQ web admin module. It runs fine on a single instance but on a cluster, there is a significant lag when loading the pages.
Is there any docker rabbitMQ setting and spring boot code which is missing or incorrect?