Search in sources :

Example 1 with FlowElection

use of org.apache.nifi.cluster.coordination.flow.FlowElection in project nifi by apache.

the class NodeClusterCoordinatorFactoryBean method getObject.

@Override
public NodeClusterCoordinator getObject() throws Exception {
    if (nodeClusterCoordinator == null && properties.isNode()) {
        final ClusterCoordinationProtocolSenderListener protocolSenderListener = applicationContext.getBean("clusterCoordinationProtocolSenderListener", ClusterCoordinationProtocolSenderListener.class);
        final EventReporter eventReporter = applicationContext.getBean("eventReporter", EventReporter.class);
        final ClusterNodeFirewall clusterFirewall = applicationContext.getBean("clusterFirewall", ClusterNodeFirewall.class);
        final RevisionManager revisionManager = applicationContext.getBean("revisionManager", RevisionManager.class);
        final LeaderElectionManager electionManager = applicationContext.getBean("leaderElectionManager", LeaderElectionManager.class);
        final FlowElection flowElection = applicationContext.getBean("flowElection", FlowElection.class);
        final NodeProtocolSender nodeProtocolSender = applicationContext.getBean("nodeProtocolSender", NodeProtocolSender.class);
        nodeClusterCoordinator = new NodeClusterCoordinator(protocolSenderListener, eventReporter, electionManager, flowElection, clusterFirewall, revisionManager, properties, nodeProtocolSender);
    }
    return nodeClusterCoordinator;
}
Also used : NodeProtocolSender(org.apache.nifi.cluster.protocol.NodeProtocolSender) LeaderElectionManager(org.apache.nifi.controller.leader.election.LeaderElectionManager) NodeClusterCoordinator(org.apache.nifi.cluster.coordination.node.NodeClusterCoordinator) ClusterNodeFirewall(org.apache.nifi.cluster.firewall.ClusterNodeFirewall) RevisionManager(org.apache.nifi.web.revision.RevisionManager) FlowElection(org.apache.nifi.cluster.coordination.flow.FlowElection) ClusterCoordinationProtocolSenderListener(org.apache.nifi.cluster.protocol.impl.ClusterCoordinationProtocolSenderListener) EventReporter(org.apache.nifi.events.EventReporter)

Example 2 with FlowElection

use of org.apache.nifi.cluster.coordination.flow.FlowElection in project nifi by apache.

the class Cluster method createNode.

public Node createNode() {
    final Map<String, String> addProps = new HashMap<>();
    addProps.put(NiFiProperties.ZOOKEEPER_CONNECT_STRING, getZooKeeperConnectString());
    addProps.put(NiFiProperties.CLUSTER_IS_NODE, "true");
    final NiFiProperties nifiProperties = NiFiProperties.createBasicNiFiProperties("src/test/resources/conf/nifi.properties", addProps);
    final FingerprintFactory fingerprintFactory = new FingerprintFactory(StringEncryptor.createEncryptor(nifiProperties));
    final FlowElection flowElection = new PopularVoteFlowElection(flowElectionTimeoutMillis, TimeUnit.MILLISECONDS, flowElectionMaxNodes, fingerprintFactory);
    final Node node = new Node(nifiProperties, flowElection);
    node.start();
    nodes.add(node);
    return node;
}
Also used : NiFiProperties(org.apache.nifi.util.NiFiProperties) PopularVoteFlowElection(org.apache.nifi.cluster.coordination.flow.PopularVoteFlowElection) HashMap(java.util.HashMap) FingerprintFactory(org.apache.nifi.fingerprint.FingerprintFactory) PopularVoteFlowElection(org.apache.nifi.cluster.coordination.flow.PopularVoteFlowElection) FlowElection(org.apache.nifi.cluster.coordination.flow.FlowElection)

Aggregations

FlowElection (org.apache.nifi.cluster.coordination.flow.FlowElection)2 HashMap (java.util.HashMap)1 PopularVoteFlowElection (org.apache.nifi.cluster.coordination.flow.PopularVoteFlowElection)1 NodeClusterCoordinator (org.apache.nifi.cluster.coordination.node.NodeClusterCoordinator)1 ClusterNodeFirewall (org.apache.nifi.cluster.firewall.ClusterNodeFirewall)1 NodeProtocolSender (org.apache.nifi.cluster.protocol.NodeProtocolSender)1 ClusterCoordinationProtocolSenderListener (org.apache.nifi.cluster.protocol.impl.ClusterCoordinationProtocolSenderListener)1 LeaderElectionManager (org.apache.nifi.controller.leader.election.LeaderElectionManager)1 EventReporter (org.apache.nifi.events.EventReporter)1 FingerprintFactory (org.apache.nifi.fingerprint.FingerprintFactory)1 NiFiProperties (org.apache.nifi.util.NiFiProperties)1 RevisionManager (org.apache.nifi.web.revision.RevisionManager)1