if (!(mode.equals(CLUSTER_LOCAL) || mode.equals(CLUSTER_PRODUCTION))) {
throw new RuntimeException("Unknown cluster type of " + mode);
}
JuggaloaderTopology juggaloaderTopology = new JuggaloaderTopology();
Config config = new Config();
config.registerSerialization(LinkedHashMap.class);
config.setFallBackOnJavaSerialization(false);
if (mode.equals(CLUSTER_LOCAL)) {
config.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, config, juggaloaderTopology.createJuggaloaderTopology());
logger.info("Start Storm Local Cluster");
}
if (mode.equals(CLUSTER_PRODUCTION)) {
config.setNumAckers(5);
try {
StormSubmitter.submitTopology(TOPOLOGY_NAME, config, juggaloaderTopology.createJuggaloaderTopology());
} catch (AlreadyAliveException | InvalidTopologyException e) {
logger.error(e.getMessage(), e);
}
logger.info("Start Storm Production Cluster");
}