Automatically delay message visibility changes while processing a message #463
Closed
mltsy
started this conversation in
Feature Request
Replies: 1 comment 3 replies
-
Hey, sorry if I am misunderstanding, but we have an option here that allows for the visibility to be extended: https://bbc.github.io/sqs-consumer/interfaces/ConsumerOptions.html#heartbeatInterval Does this not resolve what you are talking about? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
By default, SQS messages, once received, are hidden from additional consumers for 30 seconds and then become visible again (in case the consumer dies and cannot finish processing). This opens the possibility that a job that takes an unexpectedly long time to run might result in double-processing of the same message, if not properly handled.
The
message-subscriber
package offers arefreshInterval
option according to its docs that simply delays the visibility change periodically, until the message handler returns or throws. This seems like a wise choice. If the handler takes longer than the visibility timeout, you won't accidentally double-process the message, but if the process dies for some reason, both the handler and the refreshing will stop, so the message will still be re-processed correctly.Objectives
Beta Was this translation helpful? Give feedback.
All reactions