我的申请包括:
- 1 个 Amazon SQS 消息队列
- n 工人
工人有以下逻辑:
1. Wait for message from SQS queue
2. Perform task described in message
3. Delete the message from the SQS queue
4. Go to (1)
我希望每条消息只能由一名工作人员接收,以避免多余的工作。
是否有一种机制可以使用 SQS 将消息标记为“正在进行中”,以便其他轮询器不会收到它?
或者,是否适合在收到消息后立即删除?
1. Wait for message from SQS queue
2. Delete the message from the SQS queue
3. Perform task described in message
4. Go to (1)
如果我遵循这种方法,有没有办法在工作人员崩溃(步骤(3)失败)时恢复收到但未处理的消息?
这个问题是 Spring 特有的,它包含了各种各样的魔法。