use of org.apache.apex.malhar.lib.window.TriggerOption in project apex-malhar by apache.
the class TwitterAutoComplete method populateDAG.
/**
* Populate the dag with High-Level API.
* @param dag
* @param conf
*/
@Override
public void populateDAG(DAG dag, Configuration conf) {
TwitterSampleInput input = new TwitterSampleInput();
WindowOption windowOption = new WindowOption.GlobalWindow();
ApexStream<String> tags = StreamFactory.fromInput(input, input.text, name("tweetSampler")).filter(new ASCIIFilter(), name("ACSII Filter")).flatMap(new ExtractHashtags(), name("Extract Hashtags"));
ApexStream<Tuple.WindowedTuple<KeyValPair<String, List<CompletionCandidate>>>> s = tags.window(windowOption, new TriggerOption().accumulatingFiredPanes().withEarlyFiringsAtEvery(Duration.standardSeconds(10))).addCompositeStreams(ComputeTopCompletions.top(10, true)).print();
s.populateDag(dag);
}
Aggregations