Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if SQS exists in AWS using .NET

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?

like image 452
CorribView Avatar asked Jan 23 '26 09:01

CorribView


1 Answers

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

like image 164
CBredlow Avatar answered Jan 25 '26 21:01

CBredlow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!