use of org.openkilda.wfm.topology.portstate.bolt.ParsePortInfoBolt in project open-kilda by telstra.
the class PortStateTopology method createTopology.
@Override
public StormTopology createTopology() throws NameCollisionException {
final String clazzName = this.getClass().getSimpleName();
logger.debug("Building Topology - {}", clazzName);
TopologyBuilder builder = new TopologyBuilder();
/*
* Topology:
*
* TOPO_DISCO_SPOUT ---> TopoDiscoParseBolt ---> ParsePortInfoBolt ---> OtsdbKafkaBolt(kilda.otsdb topic)
* ^
* |
* WFM_STATS_SPOUT ---> WfmStatsParseBolt -----------------
*
*
* SwitchPortsSpout ---> SpeakerKafkaBolt(kilda.speaker topic)
*
*/
// Setup spout and bolt for TOPO_DISCO_SPOUT line
String topoDiscoTopic = config.getKafkaTopoDiscoTopic();
checkAndCreateTopic(topoDiscoTopic);
logger.debug("connecting to topic {}", topoDiscoTopic);
builder.setSpout(TOPO_DISCO_SPOUT, createKafkaSpout(topoDiscoTopic, clazzName + topoDiscoTopic));
TopoDiscoParseBolt topoDiscoParseBolt = new TopoDiscoParseBolt();
builder.setBolt(TOPO_DISCO_PARSE_BOLT_NAME, topoDiscoParseBolt, config.getParallelism()).shuffleGrouping(TOPO_DISCO_SPOUT);
ParsePortInfoBolt parsePortInfoBolt = new ParsePortInfoBolt();
builder.setBolt(PARSE_PORT_INFO_BOLT_NAME, parsePortInfoBolt, config.getParallelism()).shuffleGrouping(TOPO_DISCO_PARSE_BOLT_NAME, TopoDiscoParseBolt.TOPO_TO_PORT_INFO_STREAM).shuffleGrouping(WFM_STATS_PARSE_BOLT_NAME, WfmStatsParseBolt.WFM_TO_PARSE_PORT_INFO_STREAM);
final String openTsdbTopic = config.getKafkaOtsdbTopic();
checkAndCreateTopic(openTsdbTopic);
KafkaBolt openTsdbBolt = createKafkaBolt(openTsdbTopic);
builder.setBolt(OtsdbKafkaBoltName, openTsdbBolt, config.getParallelism()).shuffleGrouping(PARSE_PORT_INFO_BOLT_NAME);
// Setup spout and bolt for WFM_STATS_SPOUT line
String wfmStatsTopic = config.getKafkaStatsTopic();
checkAndCreateTopic(wfmStatsTopic);
logger.debug("conencting to topic {}", wfmStatsTopic);
builder.setSpout(WFM_STATS_SPOUT, createKafkaSpout(wfmStatsTopic, clazzName + wfmStatsTopic));
WfmStatsParseBolt wfmStatsParseBolt = new WfmStatsParseBolt();
builder.setBolt(WFM_STATS_PARSE_BOLT_NAME, wfmStatsParseBolt, config.getParallelism()).shuffleGrouping(WFM_STATS_SPOUT);
// Setup spout and bolt for sending SwitchPortsCommand every frequency seconds
SwitchPortsSpout switchPortsSpout = new SwitchPortsSpout(JANITOR_REFRESH);
builder.setSpout(SWITCH_PORTS_SPOUT_NAME, switchPortsSpout);
final String speakerTopic = config.getKafkaSpeakerTopic();
checkAndCreateTopic(speakerTopic);
KafkaBolt speakerBolt = createKafkaBolt(speakerTopic);
builder.setBolt(SpeakerBoltName, speakerBolt, config.getParallelism()).shuffleGrouping(SWITCH_PORTS_SPOUT_NAME);
return builder.createTopology();
}
Aggregations