Search in sources :

Example 1 with SpeakerWorkerBolt

use of org.openkilda.wfm.topology.switchmanager.bolt.SpeakerWorkerBolt in project open-kilda by telstra.

the class SwitchManagerTopology method createTopology.

@Override
public StormTopology createTopology() {
    logger.info("Creating SwitchManagerTopology - {}", topologyName);
    TopologyBuilder builder = new TopologyBuilder();
    ZooKeeperSpout zooKeeperSpout = new ZooKeeperSpout(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig());
    declareSpout(builder, zooKeeperSpout, ZooKeeperSpout.SPOUT_ID);
    declareSpout(builder, new CoordinatorSpout(), CoordinatorSpout.ID);
    declareBolt(builder, new CoordinatorBolt(), CoordinatorBolt.ID).allGrouping(CoordinatorSpout.ID).fieldsGrouping(SwitchManagerHub.ID, CoordinatorBolt.INCOME_STREAM, FIELDS_KEY);
    PersistenceManager persistenceManager = new PersistenceManager(configurationProvider);
    HubBolt.Config hubConfig = HubBolt.Config.builder().requestSenderComponent(HUB_SPOUT).workerComponent(SpeakerWorkerBolt.ID).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).timeoutMs((int) TimeUnit.SECONDS.toMillis(topologyConfig.getProcessTimeout())).build();
    List<String> inputTopics = Lists.newArrayList(topologyConfig.getKafkaSwitchManagerNbTopic(), topologyConfig.getKafkaSwitchManagerNetworkTopic(), topologyConfig.getKafkaSwitchManagerNbWorkerTopic());
    declareKafkaSpout(builder, inputTopics, HUB_SPOUT);
    declareBolt(builder, new SwitchManagerHub(hubConfig, persistenceManager, topologyConfig, configurationProvider.getConfiguration(FlowResourcesConfig.class), configurationProvider.getConfiguration(RuleManagerConfig.class)), SwitchManagerHub.ID).allGrouping(ZooKeeperSpout.SPOUT_ID).fieldsGrouping(HUB_SPOUT, FIELDS_KEY).directGrouping(SpeakerWorkerBolt.ID, SwitchManagerHub.INCOME_STREAM).directGrouping(CoordinatorBolt.ID);
    WorkerBolt.Config speakerWorkerConfig = WorkerBolt.Config.builder().hubComponent(SwitchManagerHub.ID).streamToHub(SwitchManagerHub.INCOME_STREAM).workerSpoutComponent(WORKER_SPOUT).defaultTimeout((int) TimeUnit.SECONDS.toMillis(topologyConfig.getOperationTimeout())).build();
    declareKafkaSpout(builder, Lists.newArrayList(topologyConfig.getKafkaSwitchManagerTopic(), topologyConfig.getGrpcResponseTopic()), WORKER_SPOUT);
    declareBolt(builder, new SpeakerWorkerBolt(speakerWorkerConfig), SpeakerWorkerBolt.ID).fieldsGrouping(WORKER_SPOUT, FIELDS_KEY).fieldsGrouping(SwitchManagerHub.ID, SpeakerWorkerBolt.INCOME_STREAM, FIELDS_KEY).directGrouping(CoordinatorBolt.ID);
    declareBolt(builder, buildKafkaBolt(topologyConfig.getKafkaNorthboundTopic()), NB_KAFKA_BOLT).shuffleGrouping(SwitchManagerHub.ID, StreamType.TO_NORTHBOUND.toString());
    declareBolt(builder, buildKafkaBolt(topologyConfig.getKafkaSpeakerTopic()), SPEAKER_KAFKA_BOLT).shuffleGrouping(SpeakerWorkerBolt.ID, StreamType.TO_FLOODLIGHT.toString());
    declareBolt(builder, buildKafkaBolt(topologyConfig.getGrpcSpeakerTopic()), GRPC_SPEAKER_KAFKA_BOLT).shuffleGrouping(SpeakerWorkerBolt.ID, StreamType.TO_GRPC.toString());
    ZooKeeperBolt zooKeeperBolt = new ZooKeeperBolt(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig(), getBoltInstancesCount(SwitchManagerHub.ID));
    declareBolt(builder, zooKeeperBolt, ZooKeeperBolt.BOLT_ID).allGrouping(SwitchManagerHub.ID, ZkStreams.ZK.toString());
    metrics(builder);
    return builder.createTopology();
}
Also used : SpeakerWorkerBolt(org.openkilda.wfm.topology.switchmanager.bolt.SpeakerWorkerBolt) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) PersistenceManager(org.openkilda.persistence.PersistenceManager) HubBolt(org.openkilda.wfm.share.hubandspoke.HubBolt) CoordinatorSpout(org.openkilda.wfm.share.hubandspoke.CoordinatorSpout) CoordinatorBolt(org.openkilda.wfm.share.hubandspoke.CoordinatorBolt) WorkerBolt(org.openkilda.wfm.share.hubandspoke.WorkerBolt) SpeakerWorkerBolt(org.openkilda.wfm.topology.switchmanager.bolt.SpeakerWorkerBolt) ZooKeeperSpout(org.openkilda.wfm.share.zk.ZooKeeperSpout) ZooKeeperBolt(org.openkilda.wfm.share.zk.ZooKeeperBolt) SwitchManagerHub(org.openkilda.wfm.topology.switchmanager.bolt.SwitchManagerHub)

Aggregations

TopologyBuilder (org.apache.storm.topology.TopologyBuilder)1 PersistenceManager (org.openkilda.persistence.PersistenceManager)1 CoordinatorBolt (org.openkilda.wfm.share.hubandspoke.CoordinatorBolt)1 CoordinatorSpout (org.openkilda.wfm.share.hubandspoke.CoordinatorSpout)1 HubBolt (org.openkilda.wfm.share.hubandspoke.HubBolt)1 WorkerBolt (org.openkilda.wfm.share.hubandspoke.WorkerBolt)1 ZooKeeperBolt (org.openkilda.wfm.share.zk.ZooKeeperBolt)1 ZooKeeperSpout (org.openkilda.wfm.share.zk.ZooKeeperSpout)1 SpeakerWorkerBolt (org.openkilda.wfm.topology.switchmanager.bolt.SpeakerWorkerBolt)1 SwitchManagerHub (org.openkilda.wfm.topology.switchmanager.bolt.SwitchManagerHub)1