/** * @param args * @throws DRPCExecutionException * @throws TException */ public static void main(String[] args) throws Exception { if (args.length < 1) { throw new IllegalArgumentException("Invalid parameter"); } Map conf = Utils.readStormConfig(); // "foo.com/blog/1" "engineering.twitter.com/blog/5" DRPCClient client = new DRPCClient(conf, args[0], 4772); String result = client.execute(ReachTopology.TOPOLOGY_NAME, "tech.backtype.com/blog/123"); System.out.println("\n!!! Drpc result:" + result); }
public DRPCClient(String host, int port) { try { this.host = host; this.port = port; connect(); } catch(TException e) { throw new RuntimeException(e); } }
DRPCClient client = new DRPCClient("drpc-host", 3772);
DRPCClient client = new DRPCClient("drpc-host", 3772); String result = client.execute("reach", "http://twitter.com");
public String execute(String func, String args) throws TException, DRPCExecutionException { try { if(client==null) connect(); return client.execute(func, args); } catch(TException e) { client = null; throw e; } catch(DRPCExecutionException e) { client = null; throw e; } }
public static void main(String[] args) throws TException, DRPCExecutionException { DRPCClient cl = new DRPCClient("localhost",3772, 9000); if (args.length != 2){ System.err.println("<functionName> <arguments>"); }else{ String func = args[0]; String argument = args[1]; System.out.println(cl.execute(func, argument)); } } }
public DRPCClient(String host, int port, Integer timeout) { try { this.host = host; this.port = port; this.timeout = timeout; connect(); } catch(TException e) { throw new RuntimeException(e); } }
public static void main(String[] args) throws TException, DRPCExecutionException { DRPCClient client = new DRPCClient(args[0], Integer.parseInt(args[1])); while (true) { System.out.println("Word count: " + client.execute("words", "cow")); Utils.sleep(1000); } } }
public String execute(String func, String args) throws TException, DRPCExecutionException { try { if(client==null) connect(); return client.execute(func, args); } catch(TException e) { client = null; throw e; } catch(DRPCExecutionException e) { client = null; throw e; } }