Skip to content

Instantly share code, notes, and snippets.

@quintona
Created February 11, 2013 04:27
Show Gist options
  • Save quintona/4752613 to your computer and use it in GitHub Desktop.
Save quintona/4752613 to your computer and use it in GitHub Desktop.
A test Gist, playing with a blog entry.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Stream getSentenceStream(TridentTopology topology, ITridentSpout spout){
Stream sentenceStream = null;
if(spout == null){
FixedBatchSpout fixedSpout = new FixedBatchSpout(new Fields("sentence"), 3,
new Values("the cow jumped over the moon"),
new Values("the man went to the store and bought some candy"),
new Values("four score and seven years ago"),
new Values("how many apples can you eat"),
new Values("to be or not to be the person"));
((FixedBatchSpout)fixedSpout).setCycle(true);
sentenceStream = topology.newStream("spout1", fixedSpout)
;
} else {
sentenceStream = topology.newStream("spout1", spout);
}
return sentenceStream
.parallelismHint(16)
.each(new Fields("sentence"), new SentenceIdGenerator(), new Fields("sentenceId"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment