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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations