public class NodeProtocolSenderListener extends Object implements NodeProtocolSender, ProtocolListener
| Modifier and Type | Field and Description |
|---|---|
private ProtocolListener |
listener |
private NodeProtocolSender |
sender |
| Constructor and Description |
|---|
NodeProtocolSenderListener(NodeProtocolSender sender,
ProtocolListener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(ProtocolHandler handler)
Registers a handler with the listener.
|
ClusterWorkloadResponseMessage |
clusterWorkload(ClusterWorkloadRequestMessage msg)
Sends a "cluster workflow request" message to the Cluster Coordinator.
|
Collection<ProtocolHandler> |
getHandlers() |
HeartbeatResponseMessage |
heartbeat(HeartbeatMessage msg,
String address)
Sends a heartbeat to the address given
|
boolean |
isRunning() |
boolean |
removeHandler(ProtocolHandler handler)
Unregisters the handler with the listener.
|
ConnectionResponseMessage |
requestConnection(ConnectionRequestMessage msg,
boolean allowConnectToSelf)
Sends a "connection request" message to the cluster manager.
|
void |
setBulletinRepository(BulletinRepository bulletinRepository)
Sets the BulletinRepository that can be used to report bulletins
|
void |
start()
Starts the instance for listening for messages.
|
void |
stop()
Stops the instance from listening for messages.
|
private final NodeProtocolSender sender
private final ProtocolListener listener
public NodeProtocolSenderListener(NodeProtocolSender sender, ProtocolListener listener)
public void stop()
throws IOException
ProtocolListenerstop in interface ProtocolListenerIOException - expublic void start()
throws IOException
ProtocolListenerstart in interface ProtocolListenerIOException - expublic boolean isRunning()
isRunning in interface ProtocolListenerpublic boolean removeHandler(ProtocolHandler handler)
ProtocolListenerremoveHandler in interface ProtocolListenerhandler - a handlerpublic Collection<ProtocolHandler> getHandlers()
getHandlers in interface ProtocolListenerpublic void addHandler(ProtocolHandler handler)
ProtocolListeneraddHandler in interface ProtocolListenerhandler - a handlerpublic ConnectionResponseMessage requestConnection(ConnectionRequestMessage msg, boolean allowConnectToSelf) throws ProtocolException, UnknownServiceAddressException
NodeProtocolSenderrequestConnection in interface NodeProtocolSendermsg - a messageallowConnectToSelf - whether or not the node should be allowed to connect to the cluster if the Cluster Coordinator is this nodeProtocolException - if communication failedUnknownServiceAddressException - if the cluster manager's address
is not knownpublic void setBulletinRepository(BulletinRepository bulletinRepository)
ProtocolListenersetBulletinRepository in interface ProtocolListenerbulletinRepository - repopublic HeartbeatResponseMessage heartbeat(HeartbeatMessage msg, String address) throws ProtocolException
NodeProtocolSenderheartbeat in interface NodeProtocolSendermsg - the heartbeat message to sendaddress - the address of the Cluster Coordinator in <hostname>:<port> formatProtocolException - if unable to send the heartbeatpublic ClusterWorkloadResponseMessage clusterWorkload(ClusterWorkloadRequestMessage msg) throws ProtocolException
NodeProtocolSenderclusterWorkload in interface NodeProtocolSendermsg - a request messageProtocolException - if communication failedCopyright © 2021 Apache NiFi Project. All rights reserved.