Created
February 11, 2013 04:27
-
-
Save quintona/4752613 to your computer and use it in GitHub Desktop.
A test Gist, playing with a blog entry.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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