Fixed Nifi reconnects with websocket server each second
This closes
@@ -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) {
