【发布时间】:2018-05-28 08:36:49
【问题描述】:
我正在阅读来自 2 个 kafka 主题的数据。可以这样描述:
Topic1 data content: VehicleRegistrationNo, Timestamp, Location
Topic2 data content: VehicleRegistrationNo, Timestamp, Speed
我需要根据两者中最近的时间戳合并这两条消息,并将元组输出为消息VehicleRegistrationNo, Timestamp, Speed, Location。我正在通过 2 个喷口 S1 和 S2 阅读这些主题。然后boltMergeS1andS2从这些spout中获取输入并作为:
if (message from S1):
save present message from S1 along with 2 previous messages (3 consecutive locations) to LocationHashMap
elseif (message from S2):
get locations details from LocationHashmap and merge speed for same Vehicle with location info, then send details to next bolt as tuple
我知道 HashMap 不是在多节点中存储数据的有效方式。所以我读到了 Trident 和 Redis 来存储中间数据。我应该使用什么来将我的中间数据存储在这个可以在分布式拓扑中工作的场景中。
【问题讨论】:
标签: java apache-storm trident