Package org.apache.storm.streams
Class StreamBuilder
java.lang.Object
org.apache.storm.streams.StreamBuilder
A builder for constructing a
StormTopology via storm streams api (DSL).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newStormTopologyfor the computation expressed via the stream api.newStream(IRichSpout spout) Creates a newStreamof tuples from the givenIRichSpout.newStream(IRichSpout spout, int parallelism) Creates a newStreamof tuples from the givenIRichSpoutwith the given parallelism.<K,V> PairStream<K, V> newStream(IRichSpout spout, PairValueMapper<K, V> pairValueMapper) Creates a newPairStreamof key-value pairs from the givenIRichSpoutby extracting key and value from tuples via the suppliedPairValueMapper.<K,V> PairStream<K, V> newStream(IRichSpout spout, PairValueMapper<K, V> pairValueMapper, int parallelism) Creates a newPairStreamof key-value pairs from the givenIRichSpoutby extracting key and value from tuples via the suppliedPairValueMapperand with the given value of parallelism.<T> Stream<T>newStream(IRichSpout spout, TupleValueMapper<T> valueMapper) Creates a newStreamof values from the givenIRichSpoutby extracting field(s) from tuples via the suppliedTupleValueMapper.<T> Stream<T>newStream(IRichSpout spout, TupleValueMapper<T> valueMapper, int parallelism) Creates a newStreamof values from the givenIRichSpoutby extracting field(s) from tuples via the suppliedTupleValueMapperwith the given parallelism.
-
Constructor Details
-
StreamBuilder
public StreamBuilder()Creates a newStreamBuilder.
-
-
Method Details
-
newStream
Creates a newStreamof tuples from the givenIRichSpout.- Parameters:
spout- the spout- Returns:
- the new stream
-
newStream
Creates a newStreamof tuples from the givenIRichSpoutwith the given parallelism.- Parameters:
spout- the spoutparallelism- the parallelism of the stream- Returns:
- the new stream
-
newStream
Creates a newStreamof values from the givenIRichSpoutby extracting field(s) from tuples via the suppliedTupleValueMapper.- Parameters:
spout- the spoutvalueMapper- the value mapper- Returns:
- the new stream
-
newStream
Creates a newStreamof values from the givenIRichSpoutby extracting field(s) from tuples via the suppliedTupleValueMapperwith the given parallelism.- Parameters:
spout- the spoutvalueMapper- the value mapperparallelism- the parallelism of the stream- Returns:
- the new stream
-
newStream
Creates a newPairStreamof key-value pairs from the givenIRichSpoutby extracting key and value from tuples via the suppliedPairValueMapper.- Parameters:
spout- the spoutpairValueMapper- the pair value mapper- Returns:
- the new stream of key-value pairs
-
newStream
public <K,V> PairStream<K,V> newStream(IRichSpout spout, PairValueMapper<K, V> pairValueMapper, int parallelism) Creates a newPairStreamof key-value pairs from the givenIRichSpoutby extracting key and value from tuples via the suppliedPairValueMapperand with the given value of parallelism.- Parameters:
spout- the spoutpairValueMapper- the pair value mapperparallelism- the parallelism of the stream- Returns:
- the new stream of key-value pairs
-
build
Builds a newStormTopologyfor the computation expressed via the stream api.- Returns:
- the storm topology
-