Redisson, working queue / dequeu. Strategies on processing message / element on incomplete message handling on system / pod shutdown

huangapple go评论90阅读模式
英文:

Redisson, working queue / dequeu. Strategies on processing message / element on incomplete message handling on system / pod shutdown

问题

所以我先获取头部元素然后开始处理。问题是,如果要扩展并使用每个Pod/实例的8线程执行器服务,在系统突然关闭时,“消息”可能已被视为已获取/已消耗。

我猜一种策略是为每个队列/出队使用一个单独的分布式Redisson 列表/映射,表示这些元素/消息正在被处理。我猜这会起作用,但是跟踪该列表也不容易。

是否有一种方法可以获取头部元素,以某种方式使用活动对象,然后标记队列中的元素为已管理,并在完成后以某种方式将其移除,复杂度为O(1)?

英文:

So I takeHead then i start processing. Problem if this is to be scaled and using an 8 thread executor service per pod/instance, on sudden shutdown of system, the "messages" would have been deemed taken / consumed already.

One strategy I guess is to use a separate distributed Redisson list / map per queue / dequeue that says that these elements / messages are being processed. I guess that would work, however keeping track of that list is not easy either.

Is there a way to takeHead, use live object somehow and then mark an element in queue as being managed, and then somehow remove it when done O(1) ?

答案1

得分: 1

所以我取了头部,然后开始处理。问题在于如果要进行扩展并且每个 pod/实例使用一个包含 8 个线程的执行器服务,系统突然关闭时,“消息” 已被视为已取出/已消耗。

您需要使用 RStream 对象,它允许跟踪每个消费者未消耗的元素。

英文:

> So I takeHead then i start processing. Problem if this is to be scaled and using an 8 thread executor service per pod/instance, on sudden shutdown of system, the "messages" would have been deemed taken / consumed already.

You need to use RStream object instead it allows to track unconsumed elements per consumer.

huangapple
  • 本文由 发表于 2020年8月25日 16:47:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/63575219.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定