Skip to content

SQS: Heartbeat for long-running handlers #1554

Open

Description

@chase-miller

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.

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html#visibility-timeout-best-practices

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.

Activity

  1. changed the title [-]SQS: Heartbeat for long-running processes[/-] [+]SQS: Heartbeat for long-running handlers[/+] on Jan 15, 2026
  2. tomazfernandes commented on Jan 16, 2026

    @tomazfernandes
    Contributor

    Hey @chase-miller, thanks for bringing this up. Your proposal sounds interesting.

    PRs are welcome, let me know if you'd like to further discuss the design before starting implementation, or perhaps open a draft PR.

    Thanks.

  3. added a commit that references this issue on May 12, 2026
    021cda9
  4. kylez-ithaka commented on May 12, 2026

    @kylez-ithaka

    Put up a PR #1622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions