ijokarumawak commented on a change in pull request #3476: NIFI-6022 ConsumeJMS 
- Added try/catch to protect against secondary exception in a…
URL: https://github.com/apache/nifi/pull/3476#discussion_r286277585
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
 ##########
 @@ -126,7 +123,11 @@ public Void doInJms(final Session session) throws 
JMSException {
                     // We need to call recover to ensure that in the event of
                     // abrupt end or exception the current session will stop 
message
                     // delivery and restart with the oldest unacknowledged 
message
-                    session.recover();
+                    try {
+                        session.recover();
+                    } catch (Exception e1) {
+                        // likely the session is closed...just ignore and 
press on with initial problem
 
 Review comment:
   I assume the intent of caching the exception `e1` here is throwing the 
original exception `e` instead so that users can see the root cause of the 
issue. Is that correct?
   If so, a comment describing that will help other devs understanding the 
purpose later.
   
   Also, please add a debug or trace level log message using `e1` here, instead 
of completely ignoring it. So that users can change processor's log level to 
see what caused recovery exception.

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


With regards,
Apache Git Services

Reply via email to