Search in sources :

Example 1 with MachineInfoAveragingPrerequisitesOperator

use of org.apache.apex.examples.machinedata.operator.MachineInfoAveragingPrerequisitesOperator in project apex-malhar by apache.

the class Application method addAverageCalculation.

/**
 * This function sets up the DAG for calculating the average
 *
 * @param dag  the DAG instance
 * @param conf the configuration instance
 * @return MachineInfoAveragingPrerequisitesOperator
 */
private MachineInfoAveragingPrerequisitesOperator addAverageCalculation(DAG dag, Configuration conf) {
    MachineInfoAveragingPrerequisitesOperator prereqAverageOper = dag.addOperator("Aggregator", MachineInfoAveragingPrerequisitesOperator.class);
    MachineInfoAveragingOperator averageOperator = dag.addOperator("AverageCalculator", MachineInfoAveragingOperator.class);
    RedisKeyValPairOutputOperator<MachineKey, Map<String, String>> redisAvgOperator = dag.addOperator("Persister", new RedisKeyValPairOutputOperator<MachineKey, Map<String, String>>());
    dag.addStream("Average", averageOperator.outputPort, redisAvgOperator.input);
    SmtpOutputOperator smtpOutputOperator = dag.addOperator("Alerter", new SmtpOutputOperator());
    dag.addStream("Aggregates", prereqAverageOper.outputPort, averageOperator.inputPort);
    dag.addStream("Alerts", averageOperator.smtpAlert, smtpOutputOperator.input);
    return prereqAverageOper;
}
Also used : MachineKey(org.apache.apex.examples.machinedata.data.MachineKey) MachineInfoAveragingOperator(org.apache.apex.examples.machinedata.operator.MachineInfoAveragingOperator) SmtpOutputOperator(org.apache.apex.malhar.lib.io.SmtpOutputOperator) MachineInfoAveragingPrerequisitesOperator(org.apache.apex.examples.machinedata.operator.MachineInfoAveragingPrerequisitesOperator) Map(java.util.Map)

Example 2 with MachineInfoAveragingPrerequisitesOperator

use of org.apache.apex.examples.machinedata.operator.MachineInfoAveragingPrerequisitesOperator in project apex-malhar by apache.

the class Application method populateDAG.

/**
 * Create the DAG
 */
@Override
public void populateDAG(DAG dag, Configuration conf) {
    InputReceiver randomGen = dag.addOperator("Receiver", InputReceiver.class);
    DimensionGenerator dimensionGenerator = dag.addOperator("DimensionsGenerator", DimensionGenerator.class);
    dag.addStream("Events", randomGen.outputInline, dimensionGenerator.inputPort);
    MachineInfoAveragingPrerequisitesOperator prereqAverageOper = addAverageCalculation(dag, conf);
    dag.addStream("DimensionalData", dimensionGenerator.outputInline, prereqAverageOper.inputPort);
}
Also used : MachineInfoAveragingPrerequisitesOperator(org.apache.apex.examples.machinedata.operator.MachineInfoAveragingPrerequisitesOperator)

Aggregations

MachineInfoAveragingPrerequisitesOperator (org.apache.apex.examples.machinedata.operator.MachineInfoAveragingPrerequisitesOperator)2 Map (java.util.Map)1 MachineKey (org.apache.apex.examples.machinedata.data.MachineKey)1 MachineInfoAveragingOperator (org.apache.apex.examples.machinedata.operator.MachineInfoAveragingOperator)1 SmtpOutputOperator (org.apache.apex.malhar.lib.io.SmtpOutputOperator)1