Package org.apache.storm.streams
Class StreamBuilder
- java.lang.Object
-
- org.apache.storm.streams.StreamBuilder
-
@Unstable public class StreamBuilder extends Object
A builder for constructing aStormTopology
via storm streams api (DSL).
-
-
Constructor Summary
Constructors Constructor Description StreamBuilder()
Creates a newStreamBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StormTopology
build()
Builds a newStormTopology
for the computation expressed via the stream api.Stream<Tuple>
newStream(IRichSpout spout)
Creates a newStream
of tuples from the givenIRichSpout
.Stream<Tuple>
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 Detail
-
StreamBuilder
public StreamBuilder()
Creates a newStreamBuilder
.
-
-
Method Detail
-
newStream
public Stream<Tuple> newStream(IRichSpout spout)
Creates a newStream
of tuples from the givenIRichSpout
.- Parameters:
spout
- the spout- Returns:
- the new stream
-
newStream
public Stream<Tuple> newStream(IRichSpout spout, int parallelism)
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
public <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
.- Parameters:
spout
- the spoutvalueMapper
- the value mapper- Returns:
- the new stream
-
newStream
public <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.- Parameters:
spout
- the spoutvalueMapper
- the value mapperparallelism
- the parallelism of the stream- Returns:
- the new stream
-
newStream
public <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
.- 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
public StormTopology build()
Builds a newStormTopology
for the computation expressed via the stream api.- Returns:
- the storm topology
-
-