public static void main(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); DRPCSpout spout = new DRPCSpout("exclamation"); builder.setSpout("drpc", spout); builder.setBolt("exclaim", new ExclamationBolt(), 3).shuffleGrouping("drpc"); builder.setBolt("return", new ReturnResults(), 3).shuffleGrouping("exclaim"); Config conf = new Config(); StormSubmitter.submitTopology("exclaim", conf, builder.createTopology()); try (DRPCClient drpc = DRPCClient.getConfiguredClient(conf)) { System.out.println(drpc.execute("exclamation", "aaa")); System.out.println(drpc.execute("exclamation", "bbb")); } }
.fieldsGrouping(PREPARE_ID, PrepareRequest.RETURN_STREAM, new Fields("request")); i++; builder.setBolt(boltId(i), new ReturnResults()) .noneGrouping(boltId(i - 1)); return builder.createTopology();
/** * Creates and initializes a Publisher that writes to the DRPC servers. Intended to be used inside a Storm * bolt in a Storm topology. * * @param config Needs the Storm configuration {@link Map} in {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONFIG}. */ public DRPCResultPublisher(BulletConfig config) { // Get the Storm Config that has all the relevant cluster settings and properties Map stormConfig = config.getRequiredConfigAs(DRPCConfig.STORM_CONFIG, Map.class); collector = new DRPCOutputCollector(); // Wrap the collector in a OutputCollector (it just delegates to the underlying DRPCOutputCollector) OutputCollector boltOutputCollector = new OutputCollector(collector); bolt = new ReturnResults(); // No need for a TopologyContext bolt.prepare(stormConfig, null, boltOutputCollector); }
/** * Creates and initializes a Publisher that writes to the DRPC servers. Intended to be used inside a Storm * bolt in a Storm topology. * * @param config Needs the Storm configuration {@link Map} in {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONFIG}. */ public DRPCResultPublisher(BulletConfig config) { // Get the Storm Config that has all the relevant cluster settings and properties Map stormConfig = config.getRequiredConfigAs(DRPCConfig.STORM_CONFIG, Map.class); collector = new DRPCOutputCollector(); // Wrap the collector in a OutputCollector (it just delegates to the underlying DRPCOutputCollector) OutputCollector boltOutputCollector = new OutputCollector(collector); bolt = new ReturnResults(); // No need for a TopologyContext bolt.prepare(stormConfig, null, boltOutputCollector); }
.fieldsGrouping(PREPARE_ID, PrepareRequest.RETURN_STREAM, new Fields("request")); i++; builder.setBolt(boltId(i), new ReturnResults()) .noneGrouping(boltId(i-1)); return builder.createTopology();