github-actions[bot] commented on code in PR #41063:
URL: https://github.com/apache/beam/pull/41063#discussion_r4499264071


##########
sdks/java/io/sparkreceiver/3/src/test/java/org/apache/beam/sdk/io/sparkreceiver/SparkReceiverIOIT.java:
##########
@@ -202,29 +202,43 @@ private void writeToRabbitMq(final List<String> messages)
           NoSuchAlgorithmException,
           KeyManagementException,
           IOException,
-          TimeoutException {
+          TimeoutException,
+          InterruptedException {
 
     final ConnectionFactory connectionFactory = new ConnectionFactory();
     connectionFactory.setUri(options.getRabbitMqBootstrapServerAddress());
+    connectionFactory.setConnectionTimeout(30000);
+    connectionFactory.setAutomaticRecoveryEnabled(true);

Review Comment:
   **🟢 Nit**: `setAutomaticRecoveryEnabled(true)` is already enabled by default 
in `com.rabbitmq.client.ConnectionFactory`, and having automatic background 
recovery active alongside the explicit `for` loop retry + `clearRabbitMQ()` 
(which deletes the stream) could allow a background recovery thread to 
reconnect on a connection before the try-with-resources block finishes closing 
it. Explicitly disabling automatic recovery (`false`) ensures clean, 
deterministic tear-down and recreation across attempts.
   
   ```suggestion
       connectionFactory.setAutomaticRecoveryEnabled(false);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to