Sometimes, we want to update any running topology based on some given conditions or rules. As of now, storm doesn’t have any direct command or code to update it, so for that there are two approaches.
First approach : Kill that topology from the command-line using :
And re-run. But what if we don’t to kill it manually and that should be automatically handled in the code.
Second Approach: Use NimbusClient to kill the topology programmatically and start again.
Above code will kill the topology. But topology takes some time to get cleared from list, therefore if you immediately start the same topology, it’ll throw the exception “Same name topology exists on the cluster”, so you need to check for few seconds.
Here is the running example:
Above code will start the Topology (if not running), otherwise will kill it and restart. You can monitor this from storm ui.