Search in sources :

Example 1 with ConstSpout

use of org.apache.storm.perf.spout.ConstSpout in project storm by apache.

the class ConstSpoutIdBoltNullBoltTopo method getTopology.

public static StormTopology getTopology(Map conf) {
    // 1 -  Setup Spout   --------
    ConstSpout spout = new ConstSpout("some data").withOutputFields("str");
    // 2 -  Setup IdBolt & DevNullBolt   --------
    IdBolt bolt1 = new IdBolt();
    DevNullBolt bolt2 = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, Helper.getInt(conf, SPOUT_COUNT, 1));
    builder.setBolt(BOLT1_ID, bolt1, Helper.getInt(conf, BOLT1_COUNT, 1)).localOrShuffleGrouping(SPOUT_ID);
    builder.setBolt(BOLT2_ID, bolt2, Helper.getInt(conf, BOLT2_COUNT, 1)).localOrShuffleGrouping(BOLT1_ID);
    return builder.createTopology();
}
Also used : IdBolt(org.apache.storm.perf.bolt.IdBolt) ConstSpout(org.apache.storm.perf.spout.ConstSpout) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt)

Example 2 with ConstSpout

use of org.apache.storm.perf.spout.ConstSpout in project storm by apache.

the class BackPressureTopo method getTopology.

static StormTopology getTopology(Map<String, Object> conf) {
    Long sleepMs = ObjectReader.getLong(conf.get(SLEEP_MS));
    // 1 -  Setup Spout   --------
    ConstSpout spout = new ConstSpout("some data").withOutputFields("string");
    // 2 -  Setup DevNull Bolt   --------
    ThrottledBolt bolt = new ThrottledBolt(sleepMs);
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, Helper.getInt(conf, SPOUT_COUNT, 1));
    BoltDeclarer bd = builder.setBolt(BOLT_ID, bolt, Helper.getInt(conf, BOLT_COUNT, 1));
    bd.localOrShuffleGrouping(SPOUT_ID);
    return builder.createTopology();
}
Also used : ConstSpout(org.apache.storm.perf.spout.ConstSpout) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) BoltDeclarer(org.apache.storm.topology.BoltDeclarer)

Example 3 with ConstSpout

use of org.apache.storm.perf.spout.ConstSpout in project storm by apache.

the class ConstSpoutNullBoltTopo method getTopology.

public static StormTopology getTopology(Map conf) {
    // 1 -  Setup Spout   --------
    ConstSpout spout = new ConstSpout("some data").withOutputFields("str");
    // 2 -  Setup DevNull Bolt   --------
    DevNullBolt bolt = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, Helper.getInt(conf, SPOUT_COUNT, 1));
    BoltDeclarer bd = builder.setBolt(BOLT_ID, bolt, Helper.getInt(conf, BOLT_COUNT, 1));
    String groupingType = Helper.getStr(conf, GROUPING);
    if (groupingType == null || groupingType.equalsIgnoreCase(DEFAULT_GROUPING))
        bd.localOrShuffleGrouping(SPOUT_ID);
    else if (groupingType.equalsIgnoreCase(SHUFFLE_GROUPING))
        bd.shuffleGrouping(SPOUT_ID);
    return builder.createTopology();
}
Also used : ConstSpout(org.apache.storm.perf.spout.ConstSpout) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) BoltDeclarer(org.apache.storm.topology.BoltDeclarer) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt)

Example 4 with ConstSpout

use of org.apache.storm.perf.spout.ConstSpout in project storm by apache.

the class ConstSpoutIdBoltNullBoltTopo method getTopology.

static StormTopology getTopology(Map<String, Object> conf) {
    // 1 -  Setup Spout   --------
    ConstSpout spout = new ConstSpout("some data").withOutputFields("str");
    // 2 -  Setup IdBolt & DevNullBolt   --------
    IdBolt bolt1 = new IdBolt();
    DevNullBolt bolt2 = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    int numSpouts = Helper.getInt(conf, SPOUT_COUNT, 1);
    builder.setSpout(SPOUT_ID, spout, numSpouts);
    int numBolt1 = Helper.getInt(conf, BOLT1_COUNT, 1);
    builder.setBolt(BOLT1_ID, bolt1, numBolt1).localOrShuffleGrouping(SPOUT_ID);
    int numBolt2 = Helper.getInt(conf, BOLT2_COUNT, 1);
    builder.setBolt(BOLT2_ID, bolt2, numBolt2).localOrShuffleGrouping(BOLT1_ID);
    System.err.printf("====> Using : numSpouts = %d , numBolt1 = %d, numBolt2=%d\n", numSpouts, numBolt1, numBolt2);
    return builder.createTopology();
}
Also used : IdBolt(org.apache.storm.perf.bolt.IdBolt) ConstSpout(org.apache.storm.perf.spout.ConstSpout) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt)

Example 5 with ConstSpout

use of org.apache.storm.perf.spout.ConstSpout in project storm by apache.

the class ConstSpoutNullBoltTopo method getTopology.

static StormTopology getTopology(Map<String, Object> conf) {
    // 1 -  Setup Spout   --------
    ConstSpout spout = new ConstSpout("some data").withOutputFields("str");
    // 2 -  Setup DevNull Bolt   --------
    DevNullBolt bolt = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    int numSpouts = Helper.getInt(conf, SPOUT_COUNT, 1);
    builder.setSpout(SPOUT_ID, spout, numSpouts);
    int numBolts = Helper.getInt(conf, BOLT_COUNT, 1);
    BoltDeclarer bd = builder.setBolt(BOLT_ID, bolt, numBolts);
    System.err.printf("====> Using : numSpouts = %d , numBolts = %d\n", numSpouts, numBolts);
    String groupingType = Helper.getStr(conf, GROUPING);
    if (groupingType == null || groupingType.equalsIgnoreCase(DEFAULT_GROUPING)) {
        bd.localOrShuffleGrouping(SPOUT_ID);
    } else if (groupingType.equalsIgnoreCase(SHUFFLE_GROUPING)) {
        bd.shuffleGrouping(SPOUT_ID);
    }
    return builder.createTopology();
}
Also used : ConstSpout(org.apache.storm.perf.spout.ConstSpout) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) BoltDeclarer(org.apache.storm.topology.BoltDeclarer) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt)

Aggregations

ConstSpout (org.apache.storm.perf.spout.ConstSpout)6 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)6 DevNullBolt (org.apache.storm.perf.bolt.DevNullBolt)4 BoltDeclarer (org.apache.storm.topology.BoltDeclarer)3 IdBolt (org.apache.storm.perf.bolt.IdBolt)2