Lehel44 commented on a change in pull request #5130:
URL: https://github.com/apache/nifi/pull/5130#discussion_r647237052



##########
File path: 
nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-processors/src/main/java/org/apache/nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java
##########
@@ -165,27 +177,36 @@ private void deregister() {
     }
 
     @Override
-    public final void onTrigger(final ProcessContext context, final 
ProcessSessionFactory sessionFactory) throws ProcessException {
+    public final void onTrigger(final ProcessContext context, final 
ProcessSessionFactory sessionFactory) {
         if (processSessionFactory == null) {
             processSessionFactory = sessionFactory;
         }
 
         if (!isProcessorRegisteredToService()) {
             try {
-                registerProcessorToService(context, webSocketService -> 
onWebSocketServiceReady(webSocketService));
-            } catch (IOException|WebSocketConfigurationException e) {
+                registerProcessorToService(context, webSocketService -> 
onWebSocketServiceReady(webSocketService, context));
+            } catch (IOException | WebSocketConfigurationException e) {
                 // Deregister processor if it failed so that it can retry next 
onTrigger.
                 deregister();
                 context.yield();
                 throw new ProcessException("Failed to register processor to 
WebSocket service due to: " + e, e);
             }
+
+        } else {
+            try {
+                onWebSocketServiceReady(webSocketService, context);
+            } catch (IOException e) {
+                deregister();
+                context.yield();
+                throw new ProcessException("Failed to renew session and 
connect to WebSocket service due to: " + e, e);

Review comment:
       I think toString here would be better. Later on it will be enough to 
just pass the exception to be displayed in the bulletins as well.




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


Reply via email to