Search in sources :

Example 1 with ConnectionHealth

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;
}
Also used : ConnectionStatusBean(org.apache.nifi.minifi.commons.status.connection.ConnectionStatusBean) ConnectionHealth(org.apache.nifi.minifi.commons.status.connection.ConnectionHealth) ConnectionStats(org.apache.nifi.minifi.commons.status.connection.ConnectionStats)

Example 2 with ConnectionHealth

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));
}
Also used : ConnectionStatusBean(org.apache.nifi.minifi.commons.status.connection.ConnectionStatusBean) ConnectionHealth(org.apache.nifi.minifi.commons.status.connection.ConnectionHealth) ConnectionStats(org.apache.nifi.minifi.commons.status.connection.ConnectionStats)

Aggregations

ConnectionHealth (org.apache.nifi.minifi.commons.status.connection.ConnectionHealth)2 ConnectionStats (org.apache.nifi.minifi.commons.status.connection.ConnectionStats)2 ConnectionStatusBean (org.apache.nifi.minifi.commons.status.connection.ConnectionStatusBean)2