Skip to content

SQS how to interrupt long polling receiveMessagesAsync in C++

0

Hi there,

I use long polling when "receiveMessagesAsync" from SQS. I set wait time to 20s, so that I don' need to make too many calls. However, when I was trying to close my instance also closing SQS thread, the long polling can't be interrupted, but had to wait for 20 seconds to finish it.

Is there a way to interrupt "receiveMessages" with long polling in C++? I did find some reference in Java checkInterrupted in java sdk, but seems in C++ "However, the client object must continue to exist until the asynchronous operation finishes".

So, how can I abort a long polling receiveMessagesAsync call in C++? *I also tried ContinousRequstHandler but that won't work.

asked 2 years ago306 views
1 Answer
0

Using the AWS C++ SDK, there is no direct way to interrupt or abort a long-polling receiveMessagesAsync call once it has been initiated. The SDK does not provide a mechanism to cancel or interrupt an ongoing asynchronous operation.

For this, you would need to have a custom implementation where you would need to monitor the state of your application and signal the need to abort the long-polling operation.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.