public Stream newDRPCStream(String function) { return newDRPCStream(new DRPCSpout(function)); }
public StormTopology createLocalTopology(ILocalDRPC drpc) { return createTopology(new DRPCSpout(function, drpc)); }
public StormTopology createRemoteTopology() { return createTopology(new DRPCSpout(function)); }
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")); } }
public Stream newDRPCStream(String function) { return newDRPCStream(new DRPCSpout(function)); }
public StormTopology createLocalTopology(ILocalDRPC drpc) { return createTopology(new DRPCSpout(_function, drpc)); }
public StormTopology createRemoteTopology() { return createTopology(new DRPCSpout(_function)); }
/** * Creates and initializes a Subscriber that reads from the DRPC servers. Intended to be used inside a Storm * spout in a Storm topology. * * @param config The config containing the String function in {@link DRPCConfig#DRPC_FUNCTION}, the Storm configuration * {@link Map} as {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONFIG} and the Storm * {@link TopologyContext} as {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONTEXT}. * @param maxUnCommittedQueries The maximum number of queries that can be read without committing them. */ public DRPCQuerySubscriber(BulletConfig config, int maxUnCommittedQueries) { super(maxUnCommittedQueries); collector = new DRPCOutputCollector(); emittedIDs = new HashMap<>(); // Get the Storm Config that has all the relevant cluster settings and properties Map stormConfig = config.getRequiredConfigAs(DRPCConfig.STORM_CONFIG, Map.class); // Get the TopologyContext TopologyContext context = config.getRequiredConfigAs(DRPCConfig.STORM_CONTEXT, TopologyContext.class); // Wrap the collector in a SpoutOutputCollector (it just delegates to the underlying DRPCOutputCollector) SpoutOutputCollector spoutOutputCollector = new SpoutOutputCollector(collector); // Get the DRPC function we should subscribe to String function = config.getRequiredConfigAs(DRPCConfig.DRPC_FUNCTION, String.class); spout = new DRPCSpout(function); spout.open(stormConfig, context, spoutOutputCollector); }
/** * Creates and initializes a Subscriber that reads from the DRPC servers. Intended to be used inside a Storm * spout in a Storm topology. * * @param config The config containing the String function in {@link DRPCConfig#DRPC_FUNCTION}, the Storm configuration * {@link Map} as {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONFIG} and the Storm * {@link TopologyContext} as {@link com.yahoo.bullet.storm.BulletStormConfig#STORM_CONTEXT}. * @param maxUnCommittedQueries The maximum number of queries that can be read without committing them. */ public DRPCQuerySubscriber(BulletConfig config, int maxUnCommittedQueries) { super(maxUnCommittedQueries); collector = new DRPCOutputCollector(); emittedIDs = new HashMap<>(); // Get the Storm Config that has all the relevant cluster settings and properties Map stormConfig = config.getRequiredConfigAs(DRPCConfig.STORM_CONFIG, Map.class); // Get the TopologyContext TopologyContext context = config.getRequiredConfigAs(DRPCConfig.STORM_CONTEXT, TopologyContext.class); // Wrap the collector in a SpoutOutputCollector (it just delegates to the underlying DRPCOutputCollector) SpoutOutputCollector spoutOutputCollector = new SpoutOutputCollector(collector); // Get the DRPC function we should subscribe to String function = config.getRequiredConfigAs(DRPCConfig.DRPC_FUNCTION, String.class); spout = new DRPCSpout(function); spout.open(stormConfig, context, spoutOutputCollector); }