Search in sources :

Example 6 with Fields

use of org.apache.heron.api.tuple.Fields in project heron by twitter.

the class LocalReadWriteTopology method main.

public static void main(String[] args) throws Exception {
    if (args.length < 3 || args.length > 4) {
        throw new RuntimeException("Expects 3 or 4 arguments, topology name, " + "inputFile, outputFile and max emit count (optional)");
    }
    String topologyName = args[0];
    String inputFile = args[1];
    String outputFile = args[2];
    TestTopologyBuilder builder = new TestTopologyBuilder(outputFile);
    builder.setTerminalBoltClass(LOCAL_AGGREGATOR_BOLT_CLASS);
    if (args.length == 3) {
        builder.setSpout("paused-local-spout", new PausedLocalFileSpout(inputFile), 1);
    } else {
        int maxEmits = Integer.parseInt(args[3]);
        builder.setSpout("paused-local-spout", new PausedLocalFileSpout(inputFile), 1, maxEmits);
    }
    builder.setBolt("identity-bolt", new IdentityBolt(new Fields("line")), 1).shuffleGrouping("paused-local-spout");
    Config conf = new BasicConfig();
    HeronSubmitter.submitTopology(topologyName, conf, builder.createTopology());
}
Also used : BasicConfig(org.apache.heron.integration_test.common.BasicConfig) IdentityBolt(org.apache.heron.integration_test.common.bolt.IdentityBolt) Fields(org.apache.heron.api.tuple.Fields) Config(org.apache.heron.api.Config) BasicConfig(org.apache.heron.integration_test.common.BasicConfig) PausedLocalFileSpout(org.apache.heron.integration_test.common.spout.PausedLocalFileSpout) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder)

Example 7 with Fields

use of org.apache.heron.api.tuple.Fields in project heron by twitter.

the class StatefulWindowingTest method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
    builder.setSpout("sentence", new RandomSentenceSpout(), 1);
    builder.setBolt("split", new SplitBolt(), 1).shuffleGrouping("sentence");
    builder.setBolt("consumer", new ConsumerBolt().withWindow(BaseWindowedBolt.Count.of(10), BaseWindowedBolt.Count.of(10)), 1).fieldsGrouping("split", new Fields("word"));
    return builder;
}
Also used : Fields(org.apache.heron.api.tuple.Fields)

Example 8 with Fields

use of org.apache.heron.api.tuple.Fields in project heron by twitter.

the class BasicTopologyOneTask method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
    builder.setSpout("ab-spout", new ABSpout(true), 1);
    builder.setBolt("identity-bolt", new IdentityBolt(new Fields("word")), 2).shuffleGrouping("ab-spout");
    return builder;
}
Also used : IdentityBolt(org.apache.heron.integration_test.common.bolt.IdentityBolt) Fields(org.apache.heron.api.tuple.Fields) ABSpout(org.apache.heron.integration_test.common.spout.ABSpout)

Example 9 with Fields

use of org.apache.heron.api.tuple.Fields in project heron by twitter.

the class FieldsGrouping method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
    builder.setSpout("ab-spout", new ABSpout(), 1, 400);
    builder.setBolt("count-bolt", new WordCountBolt(), 2).fieldsGrouping("ab-spout", new Fields("word"));
    builder.setBolt("sum-bolt", new CountAggregatorBolt(), 1).noneGrouping("count-bolt");
    return builder;
}
Also used : Fields(org.apache.heron.api.tuple.Fields) CountAggregatorBolt(org.apache.heron.integration_test.common.bolt.CountAggregatorBolt) ABSpout(org.apache.heron.integration_test.common.spout.ABSpout) WordCountBolt(org.apache.heron.integration_test.common.bolt.WordCountBolt)

Example 10 with Fields

use of org.apache.heron.api.tuple.Fields in project heron by twitter.

the class OneSpoutMultiTasks method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
    builder.setSpout("ab-spout", new ABSpout(), 3);
    builder.setBolt("identity-bolt", new IdentityBolt(new Fields("word")), 1).shuffleGrouping("ab-spout");
    return builder;
}
Also used : IdentityBolt(org.apache.heron.integration_test.common.bolt.IdentityBolt) Fields(org.apache.heron.api.tuple.Fields) ABSpout(org.apache.heron.integration_test.common.spout.ABSpout)

Aggregations

Fields (org.apache.heron.api.tuple.Fields)34 ABSpout (org.apache.heron.integration_test.common.spout.ABSpout)15 IdentityBolt (org.apache.heron.integration_test.common.bolt.IdentityBolt)13 Config (org.apache.heron.api.Config)6 TopologyBuilder (org.apache.heron.api.topology.TopologyBuilder)6 Tuple (org.apache.heron.api.tuple.Tuple)6 Values (org.apache.heron.api.tuple.Values)5 HashMap (java.util.HashMap)4 TopologyAPI (org.apache.heron.api.generated.TopologyAPI)4 TupleWindow (org.apache.heron.api.windowing.TupleWindow)4 LinkedList (java.util.LinkedList)3 TopologyContext (org.apache.heron.api.topology.TopologyContext)3 TupleWindowImpl (org.apache.heron.api.windowing.TupleWindowImpl)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 BaseBasicBolt (org.apache.heron.api.bolt.BaseBasicBolt)2 BasicOutputCollector (org.apache.heron.api.bolt.BasicOutputCollector)2 BaseRichSpout (org.apache.heron.api.spout.BaseRichSpout)2 SpoutOutputCollector (org.apache.heron.api.spout.SpoutOutputCollector)2 BoltDeclarer (org.apache.heron.api.topology.BoltDeclarer)2