Check if SQS exists in AWS using .NET

半世苍凉 提交于 2019-12-24 08:07:06

问题


I'm able to successfully send messages to a queue in .NET using the AmazonSQSClient clientin the AWSSDK.SQS package.

How can I check to see whether a specific queue exists, and if it doesn't create it?


回答1:


You'd need to run a check using the AmazonSQSClient.GetQueueUrl (string) method, where the string is the queue name. If the queue doesn't exist, it throws QueueDoesNotExistException. For you to do what you want, you'd need to catch the exception, and then create the queue using that name.

This is all listed in the SQS .Net Documentation here



来源:https://stackoverflow.com/questions/48532235/check-if-sqs-exists-in-aws-using-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!