当前位置: 首页>>代码示例>>Java>>正文


Java DRPCSpout类代码示例

本文整理汇总了Java中backtype.storm.drpc.DRPCSpout的典型用法代码示例。如果您正苦于以下问题:Java DRPCSpout类的具体用法?Java DRPCSpout怎么用?Java DRPCSpout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DRPCSpout类属于backtype.storm.drpc包,在下文中一共展示了DRPCSpout类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
public static void main(String[] args) {
  TopologyBuilder builder = new TopologyBuilder();
  LocalDRPC drpc = new LocalDRPC();

  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");

  LocalCluster cluster = new LocalCluster();
  Config conf = new Config();
  cluster.submitTopology("exclaim", conf, builder.createTopology());

  System.out.println(drpc.execute("exclamation", "aaa"));
  System.out.println(drpc.execute("exclamation", "bbb"));

}
 
开发者ID:luozhaoyu,项目名称:big-data-system,代码行数:18,代码来源:ManualDRPC.java

示例2: main

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
public static void main(String[] args) {
    TopologyBuilder builder = new TopologyBuilder();
    LocalDRPC drpc = new LocalDRPC();
    
    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");
    
    LocalCluster cluster = new LocalCluster();
    Config conf = new Config();
    cluster.submitTopology("exclaim", conf, builder.createTopology());
    
    System.out.println(drpc.execute("exclamation", "aaa"));
    System.out.println(drpc.execute("exclamation", "bbb"));
    
}
 
开发者ID:adarshms,项目名称:sentweet,代码行数:20,代码来源:ManualDRPC.java

示例3: testDrpc

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
public static void testDrpc() {
    TopologyBuilder builder = new TopologyBuilder();
    LocalDRPC drpc = new LocalDRPC();
    
    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");
    
    LocalCluster cluster = new LocalCluster();
    Config conf = new Config();
    cluster.submitTopology("exclaim", conf, builder.createTopology());
    
    JStormUtils.sleepMs(30 * 1000);
    
    try {
        System.out.println(drpc.execute("exclamation", "aaa"));
        System.out.println(drpc.execute("exclamation", "bbb"));
    } catch (Exception e) {
        Assert.fail("Failed to test drpc");
    }
    
    drpc.shutdown();
    cluster.shutdown();
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:26,代码来源:ManualDRPC.java

示例4: genSpoutIds

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
private static Map<Node, String> genSpoutIds(Collection<SpoutNode> spoutNodes) {
    Map<Node, String> ret = new HashMap<>();
    int ctr = 0;
    for(SpoutNode n: spoutNodes) {
        if (n.type == SpoutNode.SpoutType.BATCH) { // if Batch spout then id contains txId
            ret.put(n, "spout-" + n.txId);
        } else if (n.type == SpoutNode.SpoutType.DRPC){ //if DRPC spout then id contains function
            ret.put(n, "spout-" + ((DRPCSpout) n.spout).get_function() + ctr);
            ctr++;
        } else {
            ret.put(n, "spout" + ctr);
            ctr++;
        }
    }
    return ret;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:17,代码来源:TridentTopology.java

示例5: newDRPCStream

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
private Stream newDRPCStream(DRPCSpout spout) {
    // : consider adding a shuffle grouping after the spout to avoid so much routing of the args/return-info all over the place
    // (at least until its possible to just pack bolt logic into the spout itself)

    Node n = new SpoutNode(getUniqueStreamId(), TridentUtils.getSingleOutputStreamFields(spout), null, spout, SpoutNode.SpoutType.DRPC);
    Stream nextStream = addNode(n);
    // later on, this will be joined back with return-info and all the results
    return nextStream.project(new Fields("args"));
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:TridentTopology.java

示例6: newDRPCStream

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
private Stream newDRPCStream(DRPCSpout spout) {
    // TODO: consider adding a shuffle grouping after the spout to avoid so much routing of the args/return-info all over the place
    // (at least until its possible to just pack bolt logic into the spout itself)

    Node n = new SpoutNode(getUniqueStreamId(), TridentUtils.getSingleOutputStreamFields(spout), null, spout, SpoutNode.SpoutType.DRPC);
    Stream nextStream = addNode(n);
    // later on, this will be joined back with return-info and all the results
    return nextStream.project(new Fields("args"));
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:10,代码来源:TridentTopology.java

示例7: initSpout

import backtype.storm.drpc.DRPCSpout; //导入依赖的package包/类
@Override
protected IRichSpout initSpout() {
	// TODO Auto-generated method stub
	if(this.localDRPC != null) {
		//本地部署
		return new DRPCSpout(this.getTopologyName(), this.localDRPC);
	} else {
		//远程部署
		return new DRPCSpout(this.getTopologyName());
	}
}
 
开发者ID:yiyongfei,项目名称:jea,代码行数:12,代码来源:AbstractDRPCTopology.java


注:本文中的backtype.storm.drpc.DRPCSpout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。