fapaul commented on a change in pull request #16333:
URL: https://github.com/apache/flink/pull/16333#discussion_r663939481



##########
File path: 
flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSource.java
##########
@@ -273,44 +276,38 @@ public void open(Configuration config) throws Exception {
     @Override
     public void close() throws Exception {
         super.close();
+        Exception exception = null;
 
         try {
             if (consumer != null && channel != null) {
                 channel.basicCancel(consumer.getConsumerTag());
             }
         } catch (IOException e) {
-            throw new RuntimeException(
-                    "Error while cancelling RMQ consumer on "
-                            + queueName
-                            + " at "
-                            + rmqConnectionConfig.getHost(),
-                    e);
+            exception =
+                    new RuntimeException(
+                            "Error while cancelling RMQ consumer on "
+                                    + queueName
+                                    + " at "
+                                    + rmqConnectionConfig.getHost(),
+                            e);
         }
 
         try {
-            if (channel != null) {
-                channel.close();
-            }
+            IOUtils.closeAll(channel, connection);
         } catch (IOException e) {
-            throw new RuntimeException(
-                    "Error while closing RMQ channel with "
-                            + queueName
-                            + " at "
-                            + rmqConnectionConfig.getHost(),
-                    e);
+            exception =
+                    ExceptionUtils.firstOrSuppressed(
+                            new RuntimeException(
+                                    "Error while closing RMQ connection with "

Review comment:
       ```suggestion
                                       "Error while closing RMQ source with "
   ```
   I think we have to generify it now because it can be related to the channel 
or connection.




-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to