I am using spring-boot integrated with rabbitMQ. I mean construction as in this tutorial:
https://spring.io/guides/gs/messaging-rabbitmq/
I would like to do following thing:
Use application.properties
to define host, port, username, password to rabbitmq server.
Now in some class:
class SomeClass {
@Autowired
private SomeConnectionToRabbit conn;
void x(String queueName) {
use conn to get messages from some queue queueName
don't close connection, it will be needed in future.
}
}
To sum up, I am searching for solution to following problem: autowire instance of one connection to rabbitmq, use and reuse this connection to get messages from different queues (get messages means that I get all messages and I don't need to handle newly pushed messages).
Any ideas ?