Search in sources :

Example 16 with Builder

use of org.apache.heron.streamlet.Builder in project heron by twitter.

the class StreamletWithFilterAndTransform method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder testTopologyBuilder) {
    AtomicInteger atomicInteger = new AtomicInteger(0);
    Builder streamletBuilder = Builder.newBuilder();
    streamletBuilder.newSource(() -> atomicInteger.getAndIncrement()).setName("incremented-numbers").filter(i -> i <= 7).setName("numbers-lower-than-8").transform(new TextTransformer()).setName("numbers-transformed-to-text");
    BuilderImpl streamletBuilderImpl = (BuilderImpl) streamletBuilder;
    TestTopologyBuilder topology = (TestTopologyBuilder) streamletBuilderImpl.build(testTopologyBuilder);
    return topology;
}
Also used : Consumer(java.util.function.Consumer) MalformedURLException(java.net.MalformedURLException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Config(org.apache.heron.api.Config) AbstractTestTopology(org.apache.heron.integration_test.common.AbstractTestTopology) SerializableTransformer(org.apache.heron.streamlet.SerializableTransformer) Context(org.apache.heron.streamlet.Context) Builder(org.apache.heron.streamlet.Builder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder) BuilderImpl(org.apache.heron.streamlet.impl.BuilderImpl) BuilderImpl(org.apache.heron.streamlet.impl.BuilderImpl) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Builder(org.apache.heron.streamlet.Builder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder)

Aggregations

Builder (org.apache.heron.streamlet.Builder)16 Config (org.apache.heron.streamlet.Config)12 Runner (org.apache.heron.streamlet.Runner)12 Streamlet (org.apache.heron.streamlet.Streamlet)5 MalformedURLException (java.net.MalformedURLException)4 Arrays (java.util.Arrays)4 List (java.util.List)4 Config (org.apache.heron.api.Config)4 AbstractTestTopology (org.apache.heron.integration_test.common.AbstractTestTopology)4 TestTopologyBuilder (org.apache.heron.integration_test.core.TestTopologyBuilder)4 BuilderImpl (org.apache.heron.streamlet.impl.BuilderImpl)4 Logger (java.util.logging.Logger)3 StreamletUtils (org.apache.heron.examples.streamlet.utils.StreamletUtils)3 WindowConfig (org.apache.heron.streamlet.WindowConfig)3 Serializable (java.io.Serializable)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Collectors (java.util.stream.Collectors)2 IntStream (java.util.stream.IntStream)2