@SuppressWarnings("unchecked") public static Map getLocalConf(int port) { Map conf = Utils.readStormConfig(); conf.putAll(getLocalBaseConf()); List<String> zkServers = new ArrayList<>(1); zkServers.add("localhost"); conf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers); conf.put(Config.STORM_ZOOKEEPER_PORT, port); ConfigExtension.setTopologyDebugRecvTuple(conf, true); conf.put(Config.TOPOLOGY_DEBUG, true); conf.put(ConfigExtension.TOPOLOGY_BACKPRESSURE_ENABLE, false); return conf; }
@SuppressWarnings("unchecked") @Override public void submitTopologyWithOpts(String topologyName, Map conf, StormTopology topology, SubmitOptions submitOpts) { if (!Utils.isValidConf(conf)) throw new RuntimeException("Topology conf is not json-serializable"); conf.putAll(LocalUtils.getLocalBaseConf()); conf.putAll(Utils.readCommandLineOpts()); try { if (submitOpts == null) { state.getNimbus().submitTopology(topologyName, null, Utils.to_json(conf), topology); } else { state.getNimbus().submitTopologyWithOpts(topologyName, null, Utils.to_json(conf), topology, submitOpts); } } catch (Exception e) { LOG.error("failed to submit topology " + topologyName, e); throw new RuntimeException(e); } }
public static Map getLocalConf(int port) { Map conf = Utils.readStormConfig(); conf.putAll(getLocalBaseConf()); List<String> zkServers = new ArrayList<String>(1); zkServers.add("localhost"); conf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers); conf.put(Config.STORM_ZOOKEEPER_PORT, port); ConfigExtension.setTopologyDebugRecvTuple(conf, true); conf.put(Config.TOPOLOGY_DEBUG, true); conf.put(ConfigExtension.TOPOLOGY_BACKPRESSURE_ENABLE, false); return conf; }
@SuppressWarnings("unchecked") @Override public void submitTopologyWithOpts(String topologyName, Map conf, StormTopology topology, SubmitOptions submitOpts) { if (!Utils.isValidConf(conf)) throw new RuntimeException("Topology conf is not json-serializable"); conf.putAll(LocalUtils.getLocalBaseConf()); conf.putAll(Utils.readCommandLineOpts()); try { if (submitOpts == null) { state.getNimbus().submitTopology(topologyName, null, Utils.to_json(conf), topology); } else { state.getNimbus().submitTopologyWithOpts(topologyName, null, Utils.to_json(conf), topology, submitOpts); } } catch (Exception e) { LOG.error("Failed to submit topology " + topologyName, e); throw new RuntimeException(e); } }