Class StreamBuilder

java.lang.Object
org.apache.storm.streams.StreamBuilder

@Unstable public class StreamBuilder extends Object
A builder for constructing a StormTopology via storm streams api (DSL).
  • Constructor Details

    • StreamBuilder

      public StreamBuilder()
      Creates a new StreamBuilder.
  • Method Details

    • newStream

      public Stream<Tuple> newStream(IRichSpout spout)
      Creates a new Stream of tuples from the given IRichSpout.
      Parameters:
      spout - the spout
      Returns:
      the new stream
    • newStream

      public Stream<Tuple> newStream(IRichSpout spout, int parallelism)
      Creates a new Stream of tuples from the given IRichSpout with the given parallelism.
      Parameters:
      spout - the spout
      parallelism - the parallelism of the stream
      Returns:
      the new stream
    • newStream

      public <T> Stream<T> newStream(IRichSpout spout, TupleValueMapper<T> valueMapper)
      Creates a new Stream of values from the given IRichSpout by extracting field(s) from tuples via the supplied TupleValueMapper.
      Parameters:
      spout - the spout
      valueMapper - the value mapper
      Returns:
      the new stream
    • newStream

      public <T> Stream<T> newStream(IRichSpout spout, TupleValueMapper<T> valueMapper, int parallelism)
      Creates a new Stream of values from the given IRichSpout by extracting field(s) from tuples via the supplied TupleValueMapper with the given parallelism.
      Parameters:
      spout - the spout
      valueMapper - the value mapper
      parallelism - 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 new PairStream of key-value pairs from the given IRichSpout by extracting key and value from tuples via the supplied PairValueMapper.
      Parameters:
      spout - the spout
      pairValueMapper - 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 new PairStream of key-value pairs from the given IRichSpout by extracting key and value from tuples via the supplied PairValueMapper and with the given value of parallelism.
      Parameters:
      spout - the spout
      pairValueMapper - the pair value mapper
      parallelism - the parallelism of the stream
      Returns:
      the new stream of key-value pairs
    • build

      public StormTopology build()
      Builds a new StormTopology for the computation expressed via the stream api.
      Returns:
      the storm topology