Menu
AWS SDK for .NET
Developer Guide

This documentation is for version 2.0 of the AWS SDK for .NET. For the latest version, see the AWS SDK for .NET Developer Guide for version 3.

Amazon Simple Queue Service Programming with the AWS SDK for .NET

The AWS SDK for .NET supports Amazon Simple Queue Service (Amazon SQS), which is a messaging queue service that handles message or workflows between other components in a system. For more information, see the SQS Getting Started Guide.

The following information introduces you to the Amazon SQS programming models in the the SDK.

Programming Models

The the SDK provides two programming models for working with Amazon SQS. These programming models are known as the low-level and resource models. The following information describes these models, how to use them, and why you would want to use them.

Low-Level APIs

The the SDK provides low-level APIs for programming with Amazon SQS. These APIs typically consist of sets of matching request-and-response objects that correspond to HTTP-based API calls focusing on their corresponding service-level constructs.

The following example shows how to use the APIs to list accessible queues in Amazon SQS:

Copy
// using Amazon.SQS; // using Amazon.SQS.Model; var client = new AmazonSQSClient(); // List all queues that start with "aws". var request = new ListQueuesRequest { QueueNamePrefix = "aws" }; var response = client.ListQueues(request); var urls = response.QueueUrls; if (urls.Any()) { Console.WriteLine("Queue URLs:"); foreach (var url in urls) { Console.WriteLine(" " + url); } } else { Console.WriteLine("No queues."); }

For additional examples, see the following:

For related API reference information, see Amazon.SQS, Amazon.SQS.Model, and Amazon.SQS.Util in the AWS SDK for .NET Reference.

Resource APIs

The the SDK provides the AWS Resource APIs for .NET for programming with Amazon SQS. These resource APIs provide a resource-level programming model that enables you to write code to work more directly with Amazon SQS resources as compared to their low-level API counterparts. (For more information about the AWS Resource APIs for .NET, including how to download and reference these resource APIs, see Programming with the AWS Resource APIs for .NET.)

The following example shows how to use the AWS Resource APIs for .NET to list accessible queues in Amazon SQS

Copy
// using Amazon.SQS.Resources; var sqs = new SQS(); // List all queues that start with "aws". var queues = sqs.GetQueues("aws"); if (queues.Any()) { Console.WriteLine("Queue URLs:"); foreach (var queue in queues) { Console.WriteLine(" " + queue.Url); } } else { Console.WriteLine("No queues."); }

For related API reference information, see Amazon.SQS.Resources.

Topics

    On this page: