Search in sources :

Example 36 with Fields

use of com.twitter.heron.api.tuple.Fields in project incubator-heron by apache.

the class NonGrouping method buildTopology.

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

Example 37 with Fields

use of com.twitter.heron.api.tuple.Fields in project incubator-heron by apache.

the class OneSpoutBoltMultiTasks method buildTopology.

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

Example 38 with Fields

use of com.twitter.heron.api.tuple.Fields in project incubator-heron by apache.

the class OneSpoutTwoBolts method buildTopology.

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

Example 39 with Fields

use of com.twitter.heron.api.tuple.Fields in project incubator-heron by apache.

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(com.twitter.heron.integration_test.common.BasicConfig) IdentityBolt(com.twitter.heron.integration_test.common.bolt.IdentityBolt) Fields(com.twitter.heron.api.tuple.Fields) Config(com.twitter.heron.api.Config) BasicConfig(com.twitter.heron.integration_test.common.BasicConfig) PausedLocalFileSpout(com.twitter.heron.integration_test.common.spout.PausedLocalFileSpout) TestTopologyBuilder(com.twitter.heron.integration_test.core.TestTopologyBuilder)

Example 40 with Fields

use of com.twitter.heron.api.tuple.Fields in project incubator-heron by apache.

the class IntegrationTestSpout method declareOutputFields.

@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
    outputFieldsDeclarer.declareStream(Constants.INTEGRATION_TEST_CONTROL_STREAM_ID, new Fields(Constants.INTEGRATION_TEST_TERMINAL));
    delegateSpout.declareOutputFields(outputFieldsDeclarer);
}
Also used : Fields(com.twitter.heron.api.tuple.Fields)

Aggregations

Fields (com.twitter.heron.api.tuple.Fields)50 ABSpout (com.twitter.heron.integration_test.common.spout.ABSpout)22 IdentityBolt (com.twitter.heron.integration_test.common.bolt.IdentityBolt)20 Config (com.twitter.heron.api.Config)13 TopologyBuilder (com.twitter.heron.api.topology.TopologyBuilder)13 Tuple (com.twitter.heron.api.tuple.Tuple)8 TopologyArgParser (com.github.ashvina.common.TopologyArgParser)5 TopologyAPI (com.twitter.heron.api.generated.TopologyAPI)5 TopologyContext (com.twitter.heron.api.topology.TopologyContext)5 Values (com.twitter.heron.api.tuple.Values)5 HashMap (java.util.HashMap)5 BaseBasicBolt (com.twitter.heron.api.bolt.BaseBasicBolt)4 BasicOutputCollector (com.twitter.heron.api.bolt.BasicOutputCollector)4 BaseRichSpout (com.twitter.heron.api.spout.BaseRichSpout)4 SpoutOutputCollector (com.twitter.heron.api.spout.SpoutOutputCollector)4 OutputFieldsDeclarer (com.twitter.heron.api.topology.OutputFieldsDeclarer)4 TupleWindow (com.twitter.heron.api.windowing.TupleWindow)4 Map (java.util.Map)4 TupleWindowImpl (com.twitter.heron.api.windowing.TupleWindowImpl)3 ArrayList (java.util.ArrayList)3