@Override
public void stop(Application<StormEnvironment, StormTopology> executor, com.typesafe.config.Config config) {
String appId = config.getString("appId");
LOG.info("Stopping topology {} ...", appId);
if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) {
Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient();
try {
stormClient.killTopologyWithOpts(appId, this.killOptions);
} catch (NotAliveException | TException e) {
LOG.error("Failed to kill topology named {}, due to: {}",appId,e.getMessage(),e.getCause());
throw new RuntimeException(e.getMessage(),e);
}
} else {
getLocalCluster().killTopologyWithOpts(appId, this.killOptions);
}
LOG.info("Stopped topology {}", appId);
}