use of org.apache.storm.perf.bolt.DevNullBolt 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();
}
use of org.apache.storm.perf.bolt.DevNullBolt 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();
}
use of org.apache.storm.perf.bolt.DevNullBolt in project storm by apache.
the class KafkaClientSpoutNullBoltTopo method getTopology.
/**
* Create and configure the topology.
*/
public 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);
// 1 - Setup Kafka Spout --------
String bootstrapServers = Optional.ofNullable(Helper.getStr(config, BOOTSTRAP_SERVERS)).orElse("127.0.0.1:9092");
String kafkaTopic = Optional.ofNullable(Helper.getStr(config, KAFKA_TOPIC)).orElse("storm-perf-null-bolt-topic");
ProcessingGuarantee processingGuarantee = ProcessingGuarantee.valueOf(Optional.ofNullable(Helper.getStr(config, PROCESSING_GUARANTEE)).orElse(ProcessingGuarantee.AT_LEAST_ONCE.name()));
int offsetCommitPeriodMs = Helper.getInt(config, OFFSET_COMMIT_PERIOD_MS, 30_000);
KafkaSpoutConfig<String, String> kafkaSpoutConfig = KafkaSpoutConfig.builder(bootstrapServers, kafkaTopic).setProcessingGuarantee(processingGuarantee).setOffsetCommitPeriodMs(offsetCommitPeriodMs).setFirstPollOffsetStrategy(FirstPollOffsetStrategy.EARLIEST).setTupleTrackingEnforced(true).build();
KafkaSpout<String, String> spout = new KafkaSpout<>(kafkaSpoutConfig);
// 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