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;
}
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);
}
Aggregations