Search in sources :

Example 1 with ReportedEvent

use of org.apache.nifi.cluster.ReportedEvent in project nifi by apache.

the class Node method createClusterCoordinator.

@SuppressWarnings("unchecked")
private NodeClusterCoordinator createClusterCoordinator() {
    final EventReporter eventReporter = new EventReporter() {

        @Override
        public void reportEvent(Severity severity, String category, String message) {
            reportedEvents.add(new ReportedEvent(nodeId, severity, message));
        }
    };
    final ServerSocketConfiguration serverSocketConfiguration = new ServerSocketConfiguration();
    serverSocketConfiguration.setSocketTimeout(5000);
    final ProtocolContext<ProtocolMessage> protocolContext = new JaxbProtocolContext<>(JaxbProtocolUtils.JAXB_CONTEXT);
    protocolListener = new SocketProtocolListener(3, Integer.parseInt(nodeProperties.getProperty(NiFiProperties.CLUSTER_NODE_PROTOCOL_PORT)), serverSocketConfiguration, protocolContext);
    try {
        protocolListener.start();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    final ClusterCoordinationProtocolSenderListener protocolSenderListener = new ClusterCoordinationProtocolSenderListener(createCoordinatorProtocolSender(), protocolListener);
    return new NodeClusterCoordinator(protocolSenderListener, eventReporter, electionManager, flowElection, null, revisionManager, nodeProperties, protocolSender);
}
Also used : SocketProtocolListener(org.apache.nifi.cluster.protocol.impl.SocketProtocolListener) NodeClusterCoordinator(org.apache.nifi.cluster.coordination.node.NodeClusterCoordinator) Severity(org.apache.nifi.reporting.Severity) IOException(java.io.IOException) ProtocolMessage(org.apache.nifi.cluster.protocol.message.ProtocolMessage) ReportedEvent(org.apache.nifi.cluster.ReportedEvent) ServerSocketConfiguration(org.apache.nifi.io.socket.ServerSocketConfiguration) JaxbProtocolContext(org.apache.nifi.cluster.protocol.jaxb.JaxbProtocolContext) ClusterCoordinationProtocolSenderListener(org.apache.nifi.cluster.protocol.impl.ClusterCoordinationProtocolSenderListener) EventReporter(org.apache.nifi.events.EventReporter)

Aggregations

IOException (java.io.IOException)1 ReportedEvent (org.apache.nifi.cluster.ReportedEvent)1 NodeClusterCoordinator (org.apache.nifi.cluster.coordination.node.NodeClusterCoordinator)1 ClusterCoordinationProtocolSenderListener (org.apache.nifi.cluster.protocol.impl.ClusterCoordinationProtocolSenderListener)1 SocketProtocolListener (org.apache.nifi.cluster.protocol.impl.SocketProtocolListener)1 JaxbProtocolContext (org.apache.nifi.cluster.protocol.jaxb.JaxbProtocolContext)1 ProtocolMessage (org.apache.nifi.cluster.protocol.message.ProtocolMessage)1 EventReporter (org.apache.nifi.events.EventReporter)1 ServerSocketConfiguration (org.apache.nifi.io.socket.ServerSocketConfiguration)1 Severity (org.apache.nifi.reporting.Severity)1