Amraneze commented on PR #25945:
URL: https://github.com/apache/beam/pull/25945#issuecomment-1496417672

   > > > Thanks, just have a few comments about clean up. I think we can still 
get it in by the 2.47.0 cut which is tomorrow. Have you tested in your 
environement that this PR resolves the port occupying issue?
   > > 
   > > When the version 2.47.0 will be published? So I can know if I will have 
time to test in my environment. For the issue with new connection it was fixed.
   > 
   > Release cut is tomorrow, Apr 5th. Release date targetted to early May. 
   
   I'm not really confident about it. I didn't test the republish functionality 
which is a major thing for us. The problem that I can see is that in case of a 
failed connection, the DoFn thread will retry the bundle for X times during a 
duration Y. But, there is no recreating the connection again. I can suggest two 
possible ways to do it:
   
   1 - inside of the exception listener 
   
   ````java
   connection.setExceptionListener(exception -> {
     failedConnectionCounter.inc();
     // Make sure to free the failed connection 
     close();
     // Recreate a new connection with a new producer
     connect();
   });
   ````
   
   2 - inside of the loop 
   
   ````java
   connection.setExceptionListener(exception -> {
     failedConnectionCounter.inc();
     // Make sure to free the failed connection 
     close();
   });
   ...
   void connect () {
      if (producer == null) {
      ....
      }
   }
   ...
   
   void publishMessage() {
    while(true) {
     //Recreate a connection if the producer is null
     connect();
     ...
    }
   }
   ````
   
   What do you think about this?


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