storm trident merger

Posted gccbuaa

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了storm trident merger相关的知识,希望对你有一定的参考价值。




import java.util.List;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.generated.StormTopology;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import storm.trident.Stream;
import storm.trident.TridentTopology;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.testing.FixedBatchSpout;
import storm.trident.tuple.TridentTuple;


public class TridentLocalPologyMeger {
public static class SumBolt extends BaseFunction{
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Integer value0 = tuple.getInteger(0);
System.err.println("value0="+value0 );



}

}
public static void main(String[] args) {
//输出为new Fields("sentence")
FixedBatchSpout spout = new FixedBatchSpout(new Fields("sentence"), 1, new Values(9999));
spout.setCycle(true);
TridentTopology tridentTopology = new TridentTopology();
Stream newStream = tridentTopology.newStream("spout1", spout);
tridentTopology.merge(newStream)
.each(new Fields("sentence"), new SumBolt(), new Fields(""));

    LocalCluster localCluster = new LocalCluster();
    localCluster.submitTopology("trident", new Config(), tridentTopology.build());
}
}

以上是关于storm trident merger的主要内容,如果未能解决你的问题,请参考以下文章

storm trident merger

storm trident 的介绍与使用

Storm Trident状态

Storm Trident API总结-2

Storm-HBase Trident - 同时查询多个列

Storm Trident API总结-1