public HeartbeatResponseMessage createHeartbeatResponse() { return new HeartbeatResponseMessage(); }
private ProtocolMessage handleHeartbeat(final HeartbeatMessage msg) { final HeartbeatMessage heartbeatMsg = msg; final Heartbeat heartbeat = heartbeatMsg.getHeartbeat(); final NodeIdentifier nodeId = heartbeat.getNodeIdentifier(); final NodeConnectionStatus connectionStatus = heartbeat.getConnectionStatus(); final byte[] payloadBytes = heartbeat.getPayload(); final HeartbeatPayload payload = HeartbeatPayload.unmarshal(payloadBytes); final int activeThreadCount = payload.getActiveThreadCount(); final int flowFileCount = (int) payload.getTotalFlowFileCount(); final long flowFileBytes = payload.getTotalFlowFileBytes(); final long systemStartTime = payload.getSystemStartTime(); final NodeHeartbeat nodeHeartbeat = new StandardNodeHeartbeat(nodeId, System.currentTimeMillis(), connectionStatus, flowFileCount, flowFileBytes, activeThreadCount, systemStartTime); heartbeatMessages.put(heartbeat.getNodeIdentifier(), nodeHeartbeat); logger.debug("Received new heartbeat from {}", nodeId); // Formulate a List of differences between our view of the cluster topology and the node's view // and send that back to the node so that it is in-sync with us List<NodeConnectionStatus> nodeStatusList = payload.getClusterStatus(); if (nodeStatusList == null) { nodeStatusList = Collections.emptyList(); } final List<NodeConnectionStatus> updatedStatuses = getUpdatedStatuses(nodeStatusList); final HeartbeatResponseMessage responseMessage = new HeartbeatResponseMessage(); responseMessage.setUpdatedNodeStatuses(updatedStatuses); if (!getClusterCoordinator().isFlowElectionComplete()) { responseMessage.setFlowElectionMessage(getClusterCoordinator().getFlowElectionStatus()); } return responseMessage; }
Collectors.toMap(status -> status.getNodeIdentifier(), status -> status.getUpdateIdentifier())); final List<NodeConnectionStatus> updatedStatuses = responseMessage.getUpdatedNodeStatuses(); if (updatedStatuses != null) { for (final NodeConnectionStatus updatedStatus : updatedStatuses) { final String flowElectionMessage = responseMessage.getFlowElectionMessage(); final String formattedElectionMessage = flowElectionMessage == null ? "" : "; " + flowElectionMessage;
public HeartbeatResponseMessage createHeartbeatResponse() { return new HeartbeatResponseMessage(); }