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
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newStormTopology
for the computation expressed via the stream api.newStream
(IRichSpout spout) Creates a newStream
of tuples from the givenIRichSpout
.newStream
(IRichSpout spout, int parallelism) Creates a newStream
of tuples from the givenIRichSpout
with the given parallelism.<K,
V> PairStream<K, V> newStream
(IRichSpout spout, PairValueMapper<K, V> pairValueMapper) Creates a newPairStream
of key-value pairs from the givenIRichSpout
by 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 newPairStream
of key-value pairs from the givenIRichSpout
by extracting key and value from tuples via the suppliedPairValueMapper
and with the given value of parallelism.<T> Stream<T>
newStream
(IRichSpout spout, TupleValueMapper<T> valueMapper) Creates a newStream
of values from the givenIRichSpout
by extracting field(s) from tuples via the suppliedTupleValueMapper
.<T> Stream<T>
newStream
(IRichSpout spout, TupleValueMapper<T> valueMapper, int parallelism) Creates a newStream
of values from the givenIRichSpout
by extracting field(s) from tuples via the suppliedTupleValueMapper
with the given parallelism.
-
Constructor Details
-
StreamBuilder
public StreamBuilder()Creates a newStreamBuilder
.
-
-
Method Details
-
newStream
Creates a newStream
of tuples from the givenIRichSpout
.- Parameters:
spout
- the spout- Returns:
- the new stream
-
newStream
Creates a newStream
of tuples from the givenIRichSpout
with the given parallelism.- Parameters:
spout
- the spoutparallelism
- the parallelism of the stream- Returns:
- the new stream
-
newStream
Creates a newStream
of values from the givenIRichSpout
by extracting field(s) from tuples via the suppliedTupleValueMapper
.- Parameters:
spout
- the spoutvalueMapper
- the value mapper- Returns:
- the new stream
-
newStream
Creates a newStream
of values from the givenIRichSpout
by extracting field(s) from tuples via the suppliedTupleValueMapper
with the given parallelism.- Parameters:
spout
- the spoutvalueMapper
- the value mapperparallelism
- the parallelism of the stream- Returns:
- the new stream
-
newStream
Creates a newPairStream
of key-value pairs from the givenIRichSpout
by 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 newPairStream
of key-value pairs from the givenIRichSpout
by extracting key and value from tuples via the suppliedPairValueMapper
and 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 newStormTopology
for the computation expressed via the stream api.- Returns:
- the storm topology
-