Skip to content

Commit 9d49f20

Browse files
garyrussellartembilan
authored andcommitted
GH-1452: Close Connection in checkMissingQueues
Resolves #1452 While not a problem with connection factories provided by the framework (which all ignore `close()`) the code should properly close the connection after use. **cherry-pick to 2.4.x, 2.3.x**
1 parent 59197ca commit 9d49f20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/BlockingQueueConsumer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ private void checkMissingQueues() {
554554
Connection connection = null; // NOSONAR - RabbitUtils
555555
Channel channelForCheck = null;
556556
try {
557-
channelForCheck = this.connectionFactory.createConnection().createChannel(false);
557+
connection = this.connectionFactory.createConnection();
558+
channelForCheck = connection.createChannel(false);
558559
channelForCheck.queueDeclarePassive(queueToCheck);
559560
if (logger.isInfoEnabled()) {
560561
logger.info("Queue '" + queueToCheck + "' is now available");

0 commit comments

Comments
 (0)