Skip to content

Commit

Permalink
GH-1452: Close Connection in checkMissingQueues
Browse files Browse the repository at this point in the history
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**
  • Loading branch information
garyrussell authored and artembilan committed Apr 20, 2022
1 parent c554846 commit e498671
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ private void checkMissingQueues() {
Connection connection = null; // NOSONAR - RabbitUtils
Channel channelForCheck = null;
try {
channelForCheck = this.connectionFactory.createConnection().createChannel(false);
connection = this.connectionFactory.createConnection();
channelForCheck = connection.createChannel(false);
channelForCheck.queueDeclarePassive(queueToCheck);
if (logger.isInfoEnabled()) {
logger.info("Queue '" + queueToCheck + "' is now available");
Expand Down

0 comments on commit e498671

Please sign in to comment.