'Getting a strange Rabbitmq error when I start my Spring Boot server
I am trying to create a Spring Boot endpoint that consumes a message from a queue, this is my code:
@PostMapping("test")
@RabbitListener(queues = "test-queue")
public String test(@RequestBody String body, String in) {
ConnectionFactory connectionFactory = new CachingConnectionFactory();
AmqpAdmin admin = new RabbitAdmin(connectionFactory);
admin.declareQueue(new Queue("test-queue"));
return in;
}
However, I get a really strange warning when I start the Spring Boot application:
2022-05-20 14:58:40.713 WARN 78294 --- [92.168.1.3:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Socket closed)
2022-05-20 14:58:40.719 WARN 78294 --- [e01:f475%4:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Socket closed)
2022-05-20 14:58:40.726 WARN 78294 --- [e01:f474%5:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Socket closed)
2022-05-20 14:58:40.730 WARN 78294 --- [dc:4823%12:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Socket closed)
2022-05-20 14:59:40.769 WARN 78294 --- [80:5beb%14:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Socket closed)
How can I fix this?
Solution 1:[1]
This problem may be due to the fact that you are listening on the wrong port or a firewall is blocking your connection. Make sure your RabbitMQ broker is up and listening on port 5672 and that the firewall allows tcp connections to that port.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GrayNeel |
