public static void main(String[] args) throws Exception { final String name = args[0]; NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { nimbus.activate(name); LOG.info("Activated topology: {}", name); } }); } }
public static void main(String[] args) throws Exception { final String name = args[0]; NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { nimbus.deactivate(name); LOG.info("Deactivated topology: {}", name); } }); } }
public static void main(String[] args) throws Exception { NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { List<TopologySummary> topologies = nimbus.getClusterInfo().get_topologies(); if (topologies == null || topologies.isEmpty()) { System.out.println("No topologies running."); } else { System.out.printf(MSG_FORMAT, "Topology_name", "Status", "Num_tasks", "Num_workers", "Uptime_secs", "Topology_Id", "Owner"); System.out.println("----------------------------------------------------------------------------------------"); for (TopologySummary topology : topologies) { System.out.printf(MSG_FORMAT, topology.get_name(), topology.get_status(), topology.get_num_tasks(), topology.get_num_workers(), topology.get_uptime_secs(), topology.get_id(), topology.get_owner()); } } } }); } }
/** * Execute cb with a configured nimbus client that will be closed once cb returns. * @param cb the callback to send to nimbus. * @throws Exception on any kind of error. */ public static void withConfiguredClient(WithNimbus cb) throws Exception { withConfiguredClient(cb, ConfigUtils.readStormConfig()); }
NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface client) throws Exception {
NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception {
public static void main(String[] args) throws Exception { Map<String, Object> cl = CLI.opt("w", "wait", null, CLI.AS_INT) .arg("TOPO", CLI.INTO_LIST) .parse(args); final List<String> names = (List<String>) cl.get("TOPO"); Integer wait = (Integer) cl.get("w"); final KillOptions opts = new KillOptions(); if (wait != null) { opts.set_wait_secs(wait); } NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { for (String name : names) { nimbus.killTopologyWithOpts(name, opts); LOG.info("Killed topology: {}", name); } } }); } }
NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception {
NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception {
public static void withConfiguredClient(WithNimbus cb) throws Exception { withConfiguredClient(cb, ConfigUtils.readStormConfig()); }