-
Notifications
You must be signed in to change notification settings - Fork 1
lifecycleOfMsg
Tony edited this page Nov 19, 2022
·
3 revisions
消息状态
pending 待消费 消息已入队等待空闲 worker (工作协程)消费
waiting 等待中 worker 从 pending 消费消息但由于消费间隔限制,等待中
processing 处理中 worker 正处理消息中
completed 处理完成 worker 处理完并且没有返回错误
failed 处理失败 worker 处理过程奔溃或返回错误。默认自动持久化 3天,过期后删除
消息生命周期状态变化
Dequeue
--------------------------------------------------
Enqueue -> pending -> [waiting] -> processing -> completed(successfully) -> end
\ ^
\ /
\ /
+-> failed
存储中的消息总数 total = pending + waiting + processing + completed + failed。
默认后台自动清理 worker 会自动删除失效超过 7 天( (msg.created + 7 days) > now
)的任意状态消息:
- worker 将消息从 pending 队列取出后变成 processing,有可能奔溃或未知原因没机会进入 completed/failed
- 各个状态堆积的消息