AWS SQS:如何检查是否处理了多条消息
AWS SQS: How to check if several messages were processed
让我们想象一下以下情况:
我发送消息 M1
、M2
、M3
,一旦处理完这些消息,我需要发送新消息 MFinal
,因为它可以仅在之前的消息之后处理。
FIFO 队列 对我不起作用,因为我希望并行处理消息 M1
、M2
和 M3
(我有多个消费者)。
是否可以通过某种方式查看这些消息?
Is it possible to watch these messages somehow?
是的,但您需要自定义解决方案。通常消息的消费者会将消息处理的状态存储在某些数据库(例如 DynamoDB)中。将所有消息写入数据库后,您将检查并向生产者发送最终通知。
I send the messages M1, M2, M3, and once these messages are processed, I need to send new message MFinal, because it can be processed only after previous messages.
假设您可以估计何时处理您的 m1、m2、m3,那么您可以使用 延迟队列 来延迟消息
Delay queues let you postpone the delivery of new messages to a queue for a number of seconds, for example, when your consumer application needs additional time to process messages. If you create a delay queue, any messages that you send to the queue remain invisible to consumers for the duration of the delay period. The default (minimum) delay for a queue is 0 seconds. The maximum is 15 minutes
更多https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html
让我们想象一下以下情况:
我发送消息 M1
、M2
、M3
,一旦处理完这些消息,我需要发送新消息 MFinal
,因为它可以仅在之前的消息之后处理。
FIFO 队列 对我不起作用,因为我希望并行处理消息 M1
、M2
和 M3
(我有多个消费者)。
是否可以通过某种方式查看这些消息?
Is it possible to watch these messages somehow?
是的,但您需要自定义解决方案。通常消息的消费者会将消息处理的状态存储在某些数据库(例如 DynamoDB)中。将所有消息写入数据库后,您将检查并向生产者发送最终通知。
I send the messages M1, M2, M3, and once these messages are processed, I need to send new message MFinal, because it can be processed only after previous messages.
假设您可以估计何时处理您的 m1、m2、m3,那么您可以使用 延迟队列 来延迟消息
Delay queues let you postpone the delivery of new messages to a queue for a number of seconds, for example, when your consumer application needs additional time to process messages. If you create a delay queue, any messages that you send to the queue remain invisible to consumers for the duration of the delay period. The default (minimum) delay for a queue is 0 seconds. The maximum is 15 minutes
更多https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html