use of org.openkilda.wfm.ctrl.ICtrlBolt in project open-kilda by telstra.
the class OFEventWFMTopology method createTopology.
/**
* The best place to look for detailed design information regarding this topologies
* interactions is to look at docs/design/usecase/network-discovery.md
*
* At a high level, it receives input from the speaker, and sends output to the
* topology engine.
*
* @return
* @throws StreamNameCollisionException
*/
public StormTopology createTopology() throws StreamNameCollisionException {
logger.debug("Building Topology - " + this.getClass().getSimpleName());
String kafkaTopoDiscoTopic = config.getKafkaTopoDiscoTopic();
String kafkaTopoEngTopic = config.getKafkaTopoEngTopic();
String kafkaSpeakerTopic = config.getKafkaSpeakerTopic();
checkAndCreateTopic(kafkaTopoDiscoTopic);
checkAndCreateTopic(kafkaTopoEngTopic);
TopologyBuilder builder = new TopologyBuilder();
List<CtrlBoltRef> ctrlTargets = new ArrayList<>();
String spoutName = SPOUT_ID_INPUT;
String boltName = BOLT_ID;
builder.setSpout(spoutName, createKafkaSpout(kafkaTopoDiscoTopic, spoutName));
IStatefulBolt bolt = new OFELinkBolt(config);
// TODO: resolve the comments below; are there any state issues?
// NB: with shuffleGrouping, we can't maintain state .. would need to parse first
// just to pull out switchID.
// (crimi) - not sure I agree here .. state can be maintained, albeit distributed.
//
BoltDeclarer bd = builder.setBolt(boltName, bolt, config.getParallelism()).shuffleGrouping(spoutName);
builder.setBolt(kafkaTopoEngTopic, createKafkaBolt(kafkaTopoEngTopic), config.getParallelism()).shuffleGrouping(boltName, kafkaTopoEngTopic);
builder.setBolt(kafkaSpeakerTopic, createKafkaBolt(kafkaSpeakerTopic), config.getParallelism()).shuffleGrouping(boltName, kafkaSpeakerTopic);
// TODO: verify this ctrlTarget after refactoring.
ctrlTargets.add(new CtrlBoltRef(boltName, (ICtrlBolt) bolt, bd));
createCtrlBranch(builder, ctrlTargets);
// TODO: verify WFM_TOPOLOGY health check
createHealthCheckHandler(builder, ServiceType.WFM_TOPOLOGY.getId());
return builder.createTopology();
}
Aggregations