如何使storm按顺序发送元组?

nwsw7zdq  于 2021-06-24  发布在  Storm
关注(0)|答案(1)|浏览(354)

当我编写一个storm拓扑时,我发现元组的顺序并不总是和spout发出的元组的顺序相同(spout的功能是在一行中读取一个文件,并将该行发送给一个bolt,而不必使用它) Thread.sleep() ,所以这个过程会非常快)。
有谁能告诉我怎样才能保证一个喷口或一个螺栓发出的元组的顺序?谢谢!

iih3973s

iih3973s1#

你可能想看看三叉戟的拓扑结构

Trident solves this problem by doing two things:

    Each batch is given a unique id called the "transaction id". If a batch is retried it will have the exact same transaction id.
    State updates are ordered among batches. That is, the state updates for batch 3 won't be applied until the state updates for batch 2 have succeeded.

相关问题