Storm 0.9.0中trident的Spout接口变化
来源:互联网 发布:nginx 负载均衡 编辑:程序博客网 时间:2024/05/18 03:39
在Storm 0.9.0中trident的Spout接口稍有变动,以IPartitionedTridentSpout
T是序列化到ZK中用于中间状态存储的,通常用来存储消息偏移量等信息。
0.9.0之后在泛型中新增加了Partitions和Partition。在0.9.0之前,消息队列的分区直接用int类型表示,通过numPartitions方法获得分区总数N后,分区从0开始递增一直到N-1。
0.9.0之后将分区进行了包装。之前用int表示的分区现在换成用实现ISpoutPartition接口的类表示,之前numPartitions方法返回一个long类型告诉系统分区数,现在numPartitions方法换成了getPartitionsForBatch方法,返回一个自定义类型,对分区数进行抽象,实现更灵活的功能,不过我在使用中还是直接用Long类型。
简单概括总体流程就是:
trident在执行时每批先调用 Partitions getPartitionsForBatch()
如果发现返回的Partitions对象和上一批的不相等(应该是调用equals判断是否相等),则会先后调用 ListgetOrderedPartitions
其他方法和之前版本都一致,不再赘述。
另外需要注意的是0.9.0版本将log4j全部替换成了slf4j,如果自己的工程中使用了log4j,会存在slf4j与log4j的冲突,需要处理掉这些冲突。
- Storm 0.9.0中trident的Spout接口变化
- storm trident 自定义spout
- storm trident的多数据流,多spout
- Storm Trident中的Spout源码解读
- Storm中Spout和Bolt的生命周期
- storm-[4] -java.lang.NoClassDefFoundError: storm/trident/spout/ITridentSpout
- trident的多数据流,多spout
- Storm 提交拓扑后UI中spout、bolt的Num都显示为0
- storm中supervisor, task, worker, spout, bolt之间的关系
- Storm中Trident流合并的例子demo
- Storm中Spout使用注意事项小结
- Storm的Spout和Bolt中的方法
- [Trident] Storm Trident 教程
- Storm Trident
- storm trident
- Storm Trident
- Storm Trident
- Trident-storm
- 追梦赤子心
- What Is Apache Hadoop?
- Tongji OJ Problem A - A
- JavaScript快速入门
- LeetCode || Unique Paths
- Storm 0.9.0中trident的Spout接口变化
- Storm之trident序列化问题
- sed
- 使用正则表达式自动为文本中的url地址生成链接
- 谷歌是如何做代码审查的
- MySQL创建表
- Atlas源码剖析(十一)
- TabHost底部导航知识回顾之模仿微信导航
- 【iOS】protocol和delegate解析