use of org.apache.storm.drpc.ReturnResults in project storm by apache.
the class ManualDRPC method main.
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
try (LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster()) {
DRPCSpout spout = new DRPCSpout("exclamation", drpc);
builder.setSpout("drpc", spout);
builder.setBolt("exclaim", new ExclamationBolt(), 3).shuffleGrouping("drpc");
builder.setBolt("return", new ReturnResults(), 3).shuffleGrouping("exclaim");
Config conf = new Config();
try (LocalTopology topo = cluster.submitTopology("exclaim", conf, builder.createTopology())) {
System.out.println(drpc.execute("exclamation", "aaa"));
System.out.println(drpc.execute("exclamation", "bbb"));
}
}
}
Aggregations