use of com.alibaba.jstorm.transactional.TransactionTopologyBuilder in project jstorm by alibaba.
the class TransactionTestTopology method test.
public static void test() throws Exception {
TransactionTopologyBuilder builder = new TransactionTopologyBuilder();
int spout_Parallelism_hint = JStormUtils.parseInt(conf.get(SPOUT_PARALLELISM_HINT), 1);
int split_Parallelism_hint = JStormUtils.parseInt(conf.get(SPLIT_PARALLELISM_HINT), 2);
int count_Parallelism_hint = JStormUtils.parseInt(conf.get(COUNT_PARALLELISM_HINT), 2);
builder.setSpout("spout", new Spout(), spout_Parallelism_hint);
builder.setBolt("split", new Split(), split_Parallelism_hint).shuffleGrouping("spout");
builder.setBolt("count", new Count(), count_Parallelism_hint).fieldsGrouping("split", new Fields("word"));
String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
String topologyName = className[className.length - 1];
try {
JStormHelper.runTopology(builder.createTopology(), topologyName, conf, 120, new JStormHelper.CheckAckedFail(conf), isLocal);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Assert.fail("Failed");
}
}
Aggregations