Search in sources :

Example 1 with PopularVoteFlowElection

use of org.apache.nifi.cluster.coordination.flow.PopularVoteFlowElection 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

HashMap (java.util.HashMap)1 FlowElection (org.apache.nifi.cluster.coordination.flow.FlowElection)1 PopularVoteFlowElection (org.apache.nifi.cluster.coordination.flow.PopularVoteFlowElection)1 FingerprintFactory (org.apache.nifi.fingerprint.FingerprintFactory)1 NiFiProperties (org.apache.nifi.util.NiFiProperties)1