You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tu...@apache.org on 2022/01/10 12:31:54 UTC

[nifi] branch main updated: NIFI-9506: Fixed Nifi reconnects with websocket server each second

This is an automated email from the ASF dual-hosted git repository.

turcsanyi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 16bedc5  NIFI-9506: Fixed Nifi reconnects with websocket server each second
16bedc5 is described below

commit 16bedc50fa271d8f383e8f61c572704bfc6f9f17
Author: Lehel <Le...@hotmail.com>
AuthorDate: Fri Jan 7 16:09:41 2022 +0100

    NIFI-9506: Fixed Nifi reconnects with websocket server each second
    
    This closes #5645.
    
    Signed-off-by: Peter Turcsanyi <tu...@apache.org>
---
 .../nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-processors/src/main/java/org/apache/nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-processors/src/main/java/org/apache/nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java
index c516464..d3ee282 100644
--- a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-processors/src/main/java/org/apache/nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java
+++ b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-processors/src/main/java/org/apache/nifi/processors/websocket/AbstractWebSocketGatewayProcessor.java
@@ -128,9 +128,8 @@ public abstract class AbstractWebSocketGatewayProcessor extends AbstractSessionF
             if (context.hasIncomingConnection()) {
                 final ProcessSession session = processSessionFactory.createSession();
                 final FlowFile flowFile = session.get();
-                final Map<String, String> attributes = flowFile.getAttributes();
                 try {
-                    webSocketClientService.connect(endpointId, attributes);
+                    webSocketClientService.connect(endpointId, flowFile.getAttributes());
                 } finally {
                     session.remove(flowFile);
                     session.commitAsync();
@@ -195,7 +194,7 @@ public abstract class AbstractWebSocketGatewayProcessor extends AbstractSessionF
                 throw new ProcessException("Failed to register processor to WebSocket service due to: " + e, e);
             }
 
-        } else {
+        } else if (context.hasIncomingConnection()) {
             try {
                 onWebSocketServiceReady(webSocketService, context);
             } catch (IOException e) {