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 aStormTopologyvia 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 StormTopologybuild()Builds a newStormTopologyfor the computation expressed via the stream api.Stream<Tuple>newStream(IRichSpout spout)Creates a newStreamof tuples from the givenIRichSpout.Stream<Tuple>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 Detail
-
StreamBuilder
public StreamBuilder()
Creates a newStreamBuilder.
-
-
Method Detail
-
newStream
public Stream<Tuple> newStream(IRichSpout spout)
Creates a newStreamof tuples from the givenIRichSpout.- Parameters:
spout- the spout- Returns:
- the new stream
-
newStream
public Stream<Tuple> newStream(IRichSpout spout, int parallelism)
Creates a newStreamof tuples from the givenIRichSpoutwith 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 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
public <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.- 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 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
public StormTopology build()
Builds a newStormTopologyfor the computation expressed via the stream api.- Returns:
- the storm topology
-
-