Feature: Allow QueuePoller to be interrupted from another thread #2855
Labels
feature-request
A feature should be added or improved.
help wanted
We are asking the community to submit a PR to resolve this issue.
p3
This is a minor priority issue
Describe the feature
There should be a way to cleanly stop/interrupt
QueuePoller
from another thread. It should immediately abort pending poll requests, but if thepoll
callback is executing, it should wait for that to complete before returning.Use Case
I would to write code like
Signal.trap("INT") { poller.stop }
, so that I may use Ctrl+C to interrupt a daemon script that is polling SQS withQueuePoller
.Proposed Solution
The
QueuePoller
could have a methodstop
that can be invoked from any thread. If a call topoll
is awaiting an SQS poll request, the request will be immediately aborted andpoll
will return normally. Ifpoll
is executing the callback whenstop
is invoked, then it will wait until the callback returns and thenpoll
will return without making further poll requests.Other Information
No response
Acknowledgements
SDK version used
3.1.0
Environment details (OS name and version, etc.)
macOS
The text was updated successfully, but these errors were encountered: