use of org.openkilda.wfm.topology.portstate.bolt.RequestSpeakerBolt in project open-kilda by telstra.
the class PortStateTopology method createTopology.
@Override
public StormTopology createTopology() {
logger.info("Creating PortStateTopology - {}", topologyName);
TopologyBuilder builder = new TopologyBuilder();
/*
* Topology:
*
* TOPO_DISCO_SPOUT ---> TopoDiscoParseBolt ---> ParsePortInfoBolt ---> OtsdbKafkaBolt(kilda.otsdb topic)
* ^
* |
* WFM_STATS_SPOUT ---> WfmStatsParseBolt -----------------
*
*
* SwitchPortsSpout ---> SpeakerKafkaBolt(kilda.speaker topic)
*
*/
ZooKeeperSpout zooKeeperSpout = new ZooKeeperSpout(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig());
declareSpout(builder, zooKeeperSpout, ZooKeeperSpout.SPOUT_ID);
ZooKeeperBolt zooKeeperBolt = new ZooKeeperBolt(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig(), getBoltInstancesCount(TOPO_DISCO_PARSE_BOLT_NAME, WFM_STATS_PARSE_BOLT_NAME, REQUEST_SPEAKER_BOLT_NAME));
declareBolt(builder, zooKeeperBolt, ZooKeeperBolt.BOLT_ID).allGrouping(TOPO_DISCO_PARSE_BOLT_NAME, ZkStreams.ZK.toString()).allGrouping(WFM_STATS_PARSE_BOLT_NAME, ZkStreams.ZK.toString()).allGrouping(REQUEST_SPEAKER_BOLT_NAME, ZkStreams.ZK.toString());
// Setup spout and bolt for TOPO_DISCO_SPOUT line
String topoDiscoTopic = topologyConfig.getKafkaTopoDiscoTopic();
logger.debug("connecting to {} topic", topoDiscoTopic);
declareKafkaSpout(builder, topoDiscoTopic, TOPO_DISCO_SPOUT);
TopoDiscoParseBolt topoDiscoParseBolt = new TopoDiscoParseBolt(ZooKeeperSpout.SPOUT_ID);
declareBolt(builder, topoDiscoParseBolt, TOPO_DISCO_PARSE_BOLT_NAME).shuffleGrouping(TOPO_DISCO_SPOUT).allGrouping(ZooKeeperSpout.SPOUT_ID);
ParsePortInfoBolt parsePortInfoBolt = new ParsePortInfoBolt(topologyConfig.getMetricPrefix());
declareBolt(builder, parsePortInfoBolt, PARSE_PORT_INFO_BOLT_NAME).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);
String openTsdbTopic = topologyConfig.getKafkaOtsdbTopic();
KafkaBolt openTsdbBolt = createKafkaBolt(openTsdbTopic);
declareBolt(builder, openTsdbBolt, OTSDB_KAFKA_BOLT_NAME).shuffleGrouping(PARSE_PORT_INFO_BOLT_NAME);
// Setup spout and bolt for WFM_STATS_SPOUT line
String wfmStatsTopic = topologyConfig.getKafkaStatsTopic();
logger.debug("connecting to {} topic", wfmStatsTopic);
declareKafkaSpout(builder, wfmStatsTopic, WFM_STATS_SPOUT);
WfmStatsParseBolt wfmStatsParseBolt = new WfmStatsParseBolt(ZooKeeperSpout.SPOUT_ID);
declareBolt(builder, wfmStatsParseBolt, WFM_STATS_PARSE_BOLT_NAME).shuffleGrouping(WFM_STATS_SPOUT).allGrouping(ZooKeeperSpout.SPOUT_ID);
// Setup spout and bolt for sending SwitchPortsCommand every frequency seconds
SwitchPortsSpout switchPortsSpout = new SwitchPortsSpout(JANITOR_REFRESH);
declareSpout(builder, switchPortsSpout, SWITCH_PORTS_SPOUT_NAME);
RequestSpeakerBolt bolt = new RequestSpeakerBolt(ZooKeeperSpout.SPOUT_ID);
declareBolt(builder, bolt, REQUEST_SPEAKER_BOLT_NAME).shuffleGrouping(SWITCH_PORTS_SPOUT_NAME).allGrouping(ZooKeeperSpout.SPOUT_ID);
String speakerTopic = topologyConfig.getKafkaSpeakerTopic();
KafkaBolt speakerBolt = buildKafkaBolt(speakerTopic);
declareBolt(builder, speakerBolt, SPEAKER_KAFKA_BOLT_NAME).shuffleGrouping(REQUEST_SPEAKER_BOLT_NAME);
return builder.createTopology();
}
Aggregations