use of org.apache.nifi.minifi.commons.status.connection.ConnectionHealth in project nifi-minifi by apache.
the class StatusRequestParser method parseConnectionStatusRequest.
static ConnectionStatusBean parseConnectionStatusRequest(ConnectionStatus inputConnectionStatus, String statusTypes, Logger logger) {
ConnectionStatusBean connectionStatusBean = new ConnectionStatusBean();
connectionStatusBean.setName(inputConnectionStatus.getName());
String[] statusSplits = statusTypes.split(",");
for (String statusType : statusSplits) {
switch(statusType.toLowerCase().trim()) {
case "health":
ConnectionHealth connectionHealth = new ConnectionHealth();
connectionHealth.setQueuedBytes(inputConnectionStatus.getQueuedBytes());
connectionHealth.setQueuedCount(inputConnectionStatus.getQueuedCount());
connectionStatusBean.setConnectionHealth(connectionHealth);
break;
case "stats":
ConnectionStats connectionStats = new ConnectionStats();
connectionStats.setInputBytes(inputConnectionStatus.getInputBytes());
connectionStats.setInputCount(inputConnectionStatus.getInputCount());
connectionStats.setOutputCount(inputConnectionStatus.getOutputCount());
connectionStats.setOutputBytes(inputConnectionStatus.getOutputBytes());
connectionStatusBean.setConnectionStats(connectionStats);
break;
}
}
return connectionStatusBean;
}
use of org.apache.nifi.minifi.commons.status.connection.ConnectionHealth in project nifi-minifi by apache.
the class StatusReportPopulator method addConnectionStatus.
public static void addConnectionStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addStats) {
ConnectionStatusBean expectedConnectionStatus = new ConnectionStatusBean();
expectedConnectionStatus.setName("connectionId");
if (addHealth) {
ConnectionHealth connectionHealth = new ConnectionHealth();
connectionHealth.setQueuedCount(10);
connectionHealth.setQueuedBytes(100);
expectedConnectionStatus.setConnectionHealth(connectionHealth);
}
if (addStats) {
ConnectionStats expectedConnectionStats = new ConnectionStats();
expectedConnectionStats.setInputCount(1);
expectedConnectionStats.setInputBytes(2);
expectedConnectionStats.setOutputCount(3);
expectedConnectionStats.setOutputBytes(4);
expectedConnectionStatus.setConnectionStats(expectedConnectionStats);
}
flowStatusReport.setConnectionStatusList(Collections.singletonList(expectedConnectionStatus));
}
Aggregations