NIFI-9506: Fixed Nifi reconnects with websocket server each second

This closes #5645.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
This commit is contained in:
Lehel 2022-01-07 16:09:41 +01:00 committed by Peter Turcsanyi
parent 6039095625
commit 16bedc50fa
1 changed files with 2 additions and 3 deletions

View File

@ -128,9 +128,8 @@ public abstract class AbstractWebSocketGatewayProcessor extends AbstractSessionF
if (context.hasIncomingConnection()) { if (context.hasIncomingConnection()) {
final ProcessSession session = processSessionFactory.createSession(); final ProcessSession session = processSessionFactory.createSession();
final FlowFile flowFile = session.get(); final FlowFile flowFile = session.get();
final Map<String, String> attributes = flowFile.getAttributes();
try { try {
webSocketClientService.connect(endpointId, attributes); webSocketClientService.connect(endpointId, flowFile.getAttributes());
} finally { } finally {
session.remove(flowFile); session.remove(flowFile);
session.commitAsync(); 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); throw new ProcessException("Failed to register processor to WebSocket service due to: " + e, e);
} }
} else { } else if (context.hasIncomingConnection()) {
try { try {
onWebSocketServiceReady(webSocketService, context); onWebSocketServiceReady(webSocketService, context);
} catch (IOException e) { } catch (IOException e) {