Feature: SQS Heartbeating - #1622
Conversation
…ems don't go back to the queue when we are still processin ghtem
… heartbeat sink class.
…values in annotation
|
this would be a type:feature or type:enhancement, not documentation |
|
@maciejwalkowiak @MatejNedic @tomazfernandes is there anything I should adjust for this to get it queued up for a Review? |
|
Hi @kylez-ithaka, thanks for the PR. I've started reviewing it already, will get back to you soon. |
tomazfernandes
left a comment
There was a problem hiding this comment.
@kylez-ithaka thanks for the PR.
The main issue I see is that scheduling the heartbeat at intercept level only covers messages that have started processing. For ordered sinks (FIFO queues), messages from the same batch wait for their turn, so their visibility won't be extended when a previous message goes long.
We could instead schedule a single heartbeat for the whole batch in the Sink when the messages are emitted, and use a lightweight interceptor only to signal that the message is done processing and remove it from the heartbeat set.
What do you think?
|
@tomazfernandes good catch and that makes sense to be the change, I don't know if i'll get around to that update until a few weeks from now |
📢 Type of change
📜 Description
Implements / Fixes #1554 : Implement heartbeat for long running tasks.
This allows a consumer of SQS which doesn't know up front the maximum time it will process a message, to use a "heartbeat" mechanism where it periodically checks back in with SQS to extend the visibility timeout, per AWS best practices https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
This has benefits over setting a really long maximum visibility timeout
The costs over setting a really long maximum visibility timeout
💡 Motivation and Context
This is pretty standard practice for SQS, especially for longer or variable time processing. Motivating by having issues with messages ending up in dead letter because timeout wasn't long enough for some items, and caused it to be processed multiple times
💚 How did you test it?
Unit tests, and I made a queue and ran it locally, I setup a queue and put messages on it, that normally would timeout but now doesn't. I could see the logs about heart beating as well.
Note this was to test it out, one shouldn't do a heartbeat every 1 second
📝 Checklist
🔮 Next steps
Make some release that has it in it, and include in changelog?