开发者

Best way to check for "No available messages" in Amazon SQS?

I'm polling the Amazon SQS for new开发者_运维问答 messages and I'm trying to decide the best way to check for "No available messages".

AmazonSQS sqs = new AmazonSQS();  //pseudo code this line
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
receiveMessageRequest.QueueUrl = myQueueUrl;
ReceiveMessageResponse receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
if (receiveMessageResponse.IsSetReceiveMessageResult())
    {
        //Always TRUE even if there are no untaken messages 
    }

This doesn't seem to work as a way to check for "No available messages". Any thoughts on the proper way to check? Thank you!


ReceiveMessageResult r = receiveMessageResponse.ReceiveMessageResult;

if (r.Message.Count < 1)
{
  Console.WriteLine("Can't find any visible messages.");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜