Package com.alibaba.jstorm.batch

Examples of com.alibaba.jstorm.batch.BatchTopologyBuilder


    topologyName = (String) conf.get(Config.TOPOLOGY_NAME);
    return;
  }

  public static TopologyBuilder SetBuilder() {
    BatchTopologyBuilder topologyBuilder = new BatchTopologyBuilder(
        topologyName);
   
    int spoutParallel = JStormUtils.parseInt(conf.get("topology.spout.parallel"), 1);

    BoltDeclarer boltDeclarer = topologyBuilder.setSpout("Spout",
        new SimpleSpout(), spoutParallel);

    int boltParallel = JStormUtils.parseInt(conf.get("topology.bolt.parallel"), 2);
    topologyBuilder.setBolt("Bolt", new SimpleBolt(), boltParallel).shuffleGrouping(
        "Spout");

    return topologyBuilder.getTopologyBuilder();
  }
View Full Code Here


    return ret;
  }

  public static TopologyBuilder SetBuilder() {

    BatchTopologyBuilder batchTopologyBuilder = new BatchTopologyBuilder(
        topologyName);

    MetaSpoutConfig metaSpoutConfig = getMetaSpoutConfig(conf);

    BoltDeclarer rebalanceDeclarer = batchTopologyBuilder.setBolt(
        BatchMetaRebalance.BOLT_NAME, new BatchMetaRebalance(), 1);

    IBatchSpout batchSpout = new BatchMetaSpout(metaSpoutConfig);
    int spoutParal = JStormUtils.parseInt(
        conf.get("topology.spout.parallel"), 1);
    BoltDeclarer spoutDeclarer = batchTopologyBuilder.setSpout(
        BatchMetaSpout.SPOUT_NAME, batchSpout, spoutParal);
    spoutDeclarer.allGrouping(BatchMetaRebalance.BOLT_NAME,
        BatchMetaRebalance.REBALANCE_STREAM_ID);

    int boltParallel = JStormUtils.parseInt(
        conf.get("topology.bolt.parallel"), 1);
    BoltDeclarer transformDeclarer = batchTopologyBuilder.setBolt(
        TransformBolt.BOLT_NAME, new TransformBolt(), boltParallel);
    transformDeclarer.shuffleGrouping(BatchMetaSpout.SPOUT_NAME);

    BoltDeclarer countDeclarer = batchTopologyBuilder.setBolt(
        CountBolt.COUNT_BOLT_NAME, new CountBolt(), boltParallel);
    countDeclarer.shuffleGrouping(TransformBolt.BOLT_NAME);

    BoltDeclarer sumDeclarer = batchTopologyBuilder.setBolt(
        CountBolt.SUM_BOLT_NAME, new CountBolt(), boltParallel);
    sumDeclarer.shuffleGrouping(TransformBolt.BOLT_NAME);

    BoltDeclarer dbDeclarer = batchTopologyBuilder.setBolt(
        DBBolt.BOLT_NAME, new DBBolt(), 1);
    dbDeclarer.shuffleGrouping(CountBolt.COUNT_BOLT_NAME).shuffleGrouping(
        CountBolt.SUM_BOLT_NAME);

    return batchTopologyBuilder.getTopologyBuilder();
  }
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.batch.BatchTopologyBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.