dirkbig commented on a change in pull request #3971: NIFI-6997: consumeAMQP 
closing connection when queue not found 
URL: https://github.com/apache/nifi/pull/3971#discussion_r366239421
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java
 ##########
 @@ -194,6 +194,13 @@ protected synchronized AMQPConsumer 
createAMQPWorker(final ProcessContext contex
 
             return amqpConsumer;
         } catch (final IOException ioe) {
+            try {
+                connection.close();
+                getLogger().warn("Closed connection at port " + 
connection.getPort());
+            } catch (final IOException ioeClose) {
+                throw new ProcessException("Failed to close connection at port 
" + connection.getPort());
 
 Review comment:
   would it be a good idea to swallow the ioeClose exception by means of a 
warn-log? (and indeed remove the previous logging of the succesful closing of 
connection:
   
   ```java
           } catch (final IOException ioe) {
               try {
                   connection.close();
               } catch (final IOException ioeClose) {
                   getLogger().warn("Failed to close connection at port " + 
connection.getPort(), ioeClose);
               }
   
               throw new ProcessException("Failed to connect to AMQP Broker", 
ioe);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to