Redisson,工作队列/出队.在系统/pod关闭时处理消息/元素的不完整消息处理策略 [英] Redisson, working queue / dequeu. Strategies on processing message / element on incomplete message handling on system / pod shutdown

查看:40
本文介绍了Redisson,工作队列/出队.在系统/pod关闭时处理消息/元素的不完整消息处理策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我takeHead然后我开始处理.如果要扩展并使用每个 pod/实例的 8 线程执行程序服务,在系统突然关闭时,消息"会出现问题.将被视为已被占用/消耗.

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.

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

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.

有没有办法获取头,以某种方式使用活动对象,然后将队列中的元素标记为被管理,然后在完成 O(1) 后以某种方式将其删除?

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) ?

推荐答案

所以我带头然后我开始处理.如果要扩展并使用每个 pod/实例的 8 线程执行程序服务,在系统突然关闭时,消息"会出现问题.将被视为已被占用/消耗.

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.

您需要使用 RStream 对象来代替它允许跟踪每个消费者未使用的元素.

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

这篇关于Redisson,工作队列/出队.在系统/pod关闭时处理消息/元素的不完整消息处理策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆