Search in sources :

Example 1 with DevNullBolt

use of org.apache.storm.perf.bolt.DevNullBolt 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 DevNullBolt

use of org.apache.storm.perf.bolt.DevNullBolt in project storm by apache.

the class HdfsSpoutNullBoltTopo method getTopology.

static StormTopology getTopology(Map<String, Object> config) {
    final int spoutNum = Helper.getInt(config, SPOUT_NUM, DEFAULT_SPOUT_NUM);
    final int boltNum = Helper.getInt(config, BOLT_NUM, DEFAULT_BOLT_NUM);
    final String fileFormat = Helper.getStr(config, "text");
    final String hdfsUri = Helper.getStr(config, HDFS_URI);
    final String sourceDir = Helper.getStr(config, SOURCE_DIR);
    final String archiveDir = Helper.getStr(config, ARCHIVE_DIR);
    final String badDir = Helper.getStr(config, BAD_DIR);
    // 1 -  Setup Hdfs Spout   --------
    HdfsSpout spout = new HdfsSpout().setReaderType(fileFormat).setHdfsUri(hdfsUri).setSourceDir(sourceDir).setArchiveDir(archiveDir).setBadFilesDir(badDir).withOutputFields(TextFileReader.defaultFields);
    // 2 -   DevNull Bolt   --------
    DevNullBolt bolt = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, spoutNum);
    builder.setBolt(BOLT_ID, bolt, boltNum).localOrShuffleGrouping(SPOUT_ID);
    return builder.createTopology();
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt) HdfsSpout(org.apache.storm.hdfs.spout.HdfsSpout)

Example 3 with DevNullBolt

use of org.apache.storm.perf.bolt.DevNullBolt 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 DevNullBolt

use of org.apache.storm.perf.bolt.DevNullBolt in project storm by apache.

the class HdfsSpoutNullBoltTopo method getTopology.

public static StormTopology getTopology(Map config) {
    final int spoutNum = Helper.getInt(config, SPOUT_NUM, DEFAULT_SPOUT_NUM);
    final int boltNum = Helper.getInt(config, BOLT_NUM, DEFAULT_BOLT_NUM);
    final String fileFormat = Helper.getStr(config, "text");
    final String hdfsUri = Helper.getStr(config, HDFS_URI);
    final String sourceDir = Helper.getStr(config, SOURCE_DIR);
    final String archiveDir = Helper.getStr(config, ARCHIVE_DIR);
    final String badDir = Helper.getStr(config, BAD_DIR);
    // 1 -  Setup Hdfs Spout   --------
    HdfsSpout spout = new HdfsSpout().setReaderType(fileFormat).setHdfsUri(hdfsUri).setSourceDir(sourceDir).setArchiveDir(archiveDir).setBadFilesDir(badDir).withOutputFields(TextFileReader.defaultFields);
    // 2 -   DevNull Bolt   --------
    DevNullBolt bolt = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, spoutNum);
    builder.setBolt(BOLT_ID, bolt, boltNum).localOrShuffleGrouping(SPOUT_ID);
    return builder.createTopology();
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt) HdfsSpout(org.apache.storm.hdfs.spout.HdfsSpout)

Example 5 with DevNullBolt

use of org.apache.storm.perf.bolt.DevNullBolt in project storm by apache.

the class KafkaSpoutNullBoltTopo method getTopology.

public static StormTopology getTopology(Map config) {
    final int spoutNum = getInt(config, SPOUT_NUM, DEFAULT_SPOUT_NUM);
    final int boltNum = getInt(config, BOLT_NUM, DEFAULT_BOLT_NUM);
    // 1 -  Setup Kafka Spout   --------
    String zkConnString = getStr(config, ZOOKEEPER_URI);
    String topicName = getStr(config, KAFKA_TOPIC);
    BrokerHosts brokerHosts = new ZkHosts(zkConnString);
    SpoutConfig spoutConfig = new SpoutConfig(brokerHosts, topicName, "/" + topicName, UUID.randomUUID().toString());
    spoutConfig.scheme = new StringMultiSchemeWithTopic();
    spoutConfig.ignoreZkOffsets = true;
    KafkaSpout spout = new KafkaSpout(spoutConfig);
    // 2 -   DevNull Bolt   --------
    DevNullBolt bolt = new DevNullBolt();
    // 3 - Setup Topology  --------
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(SPOUT_ID, spout, spoutNum);
    builder.setBolt(BOLT_ID, bolt, boltNum).localOrShuffleGrouping(SPOUT_ID);
    return builder.createTopology();
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) SpoutConfig(org.apache.storm.kafka.SpoutConfig) DevNullBolt(org.apache.storm.perf.bolt.DevNullBolt) ZkHosts(org.apache.storm.kafka.ZkHosts) StringMultiSchemeWithTopic(org.apache.storm.kafka.StringMultiSchemeWithTopic) KafkaSpout(org.apache.storm.kafka.KafkaSpout) BrokerHosts(org.apache.storm.kafka.BrokerHosts)

Aggregations

DevNullBolt (org.apache.storm.perf.bolt.DevNullBolt)8 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)8 ConstSpout (org.apache.storm.perf.spout.ConstSpout)4 HdfsSpout (org.apache.storm.hdfs.spout.HdfsSpout)2 IdBolt (org.apache.storm.perf.bolt.IdBolt)2 BoltDeclarer (org.apache.storm.topology.BoltDeclarer)2 BrokerHosts (org.apache.storm.kafka.BrokerHosts)1 KafkaSpout (org.apache.storm.kafka.KafkaSpout)1 SpoutConfig (org.apache.storm.kafka.SpoutConfig)1 StringMultiSchemeWithTopic (org.apache.storm.kafka.StringMultiSchemeWithTopic)1 ZkHosts (org.apache.storm.kafka.ZkHosts)1 KafkaSpout (org.apache.storm.kafka.spout.KafkaSpout)1 ProcessingGuarantee (org.apache.storm.kafka.spout.KafkaSpoutConfig.ProcessingGuarantee)1