use of org.apache.nifi.cluster.coordination.heartbeat.HeartbeatMonitor in project nifi by apache.
the class Node method start.
public synchronized void start() {
running = true;
protocolSender = createNodeProtocolSender();
clusterCoordinator = createClusterCoordinator();
clusterCoordinator.setLocalNodeIdentifier(nodeId);
// clusterCoordinator.setConnected(true);
final HeartbeatMonitor heartbeatMonitor = createHeartbeatMonitor();
flowController = FlowController.createClusteredInstance(Mockito.mock(FlowFileEventRepository.class), nodeProperties, null, null, StringEncryptor.createEncryptor(nodeProperties), protocolSender, Mockito.mock(BulletinRepository.class), clusterCoordinator, heartbeatMonitor, electionManager, VariableRegistry.EMPTY_REGISTRY, Mockito.mock(FlowRegistryClient.class));
try {
flowController.initializeFlow();
} catch (IOException e) {
throw new RuntimeException(e);
}
final NodeProtocolSenderListener senderListener = new NodeProtocolSenderListener(protocolSender, protocolListener);
try {
flowController.getStateManagerProvider().getStateManager("Cluster Node Configuration").setState(Collections.singletonMap("Node UUID", nodeId.getId()), Scope.LOCAL);
flowService = StandardFlowService.createClusteredInstance(flowController, nodeProperties, senderListener, clusterCoordinator, StringEncryptor.createEncryptor(nodeProperties), revisionManager, Mockito.mock(Authorizer.class));
flowService.start();
flowService.load(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.nifi.cluster.coordination.heartbeat.HeartbeatMonitor in project nifi by apache.
the class FlowControllerFactoryBean method getObject.
@Override
public Object getObject() throws Exception {
if (flowController == null) {
final FlowFileEventRepository flowFileEventRepository = applicationContext.getBean("flowFileEventRepository", FlowFileEventRepository.class);
if (properties.isNode()) {
final NodeProtocolSender nodeProtocolSender = applicationContext.getBean("nodeProtocolSender", NodeProtocolSender.class);
final HeartbeatMonitor heartbeatMonitor = applicationContext.getBean("heartbeatMonitor", HeartbeatMonitor.class);
flowController = FlowController.createClusteredInstance(flowFileEventRepository, properties, authorizer, auditService, encryptor, nodeProtocolSender, bulletinRepository, clusterCoordinator, heartbeatMonitor, leaderElectionManager, variableRegistry, flowRegistryClient);
} else {
flowController = FlowController.createStandaloneInstance(flowFileEventRepository, properties, authorizer, auditService, encryptor, bulletinRepository, variableRegistry, flowRegistryClient);
}
}
return flowController;
}
Aggregations