-
-
Notifications
You must be signed in to change notification settings - Fork 367
Description
Type: Feature
Is your feature request related to a problem? Please describe.
Without a heartbeat / keep-alive mechanism, a given message may be picked up multiple times by handlers (if it is long-running with variable time) and executed concurrently.
Describe the solution you'd like
A new SqsListener.UseHeartbeat property that - when set to true - keeps a given sqs message alive by extending its (in)visibility in the background.
Describe alternatives you've considered
An alternative is to inject an Visibility instance and do this manually in each handler.
Additional context
Implementing a heartbeat is recommended by AWS.
Implement a heartbeat mechanism to periodically extend the visibility timeout, ensuring the message remains invisible until processing is complete.
As an aside, we've implemented this pattern in C# using a background thread (via Task.Run()) that stops a heartbeat and manages failures via CancellationTokens. This has proven effective.