Amazon.SQS.AmazonSQSClient.GetQueueUrlAsync C# (CSharp) Method

GetQueueUrlAsync() public method

Returns the URL of an existing queue. This action provides a simple way to retrieve the URL of an Amazon SQS queue.

To access a queue that belongs to another AWS account, use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue's owner. The queue's owner must grant you permission to access the queue. For more information about shared queue access, see AddPermission or see Shared Queues in the Amazon SQS Developer Guide.

/// The queue referred to doesn't exist. ///
public GetQueueUrlAsync ( string queueName, GetQueueUrlResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
queueName string The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric characters, hyphens (-), and underscores (_). Queue names are case-sensitive.
callback GetQueueUrlResponse>.AmazonServiceCallback An Action delegate that is invoked when the operation completes.
options Amazon.Runtime.AsyncOptions /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. ///
return void
        public void GetQueueUrlAsync(string queueName,  AmazonServiceCallback<GetQueueUrlRequest, GetQueueUrlResponse> callback, AsyncOptions options = null)
        {
            var request = new GetQueueUrlRequest();
            request.QueueName = queueName;
            GetQueueUrlAsync(request, callback, options);
        }

Same methods

AmazonSQSClient::GetQueueUrlAsync ( GetQueueUrlRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonSQSClient::GetQueueUrlAsync ( string queueName, System cancellationToken = default(CancellationToken) ) : Task
AmazonSQSClient::GetQueueUrlAsync ( GetQueueUrlRequest request, GetQueueUrlResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

Example #1
0
        public async Task SendAsync(string message, CancellationToken token)
        {
            // Console.WriteLine("Sending messages:");

            using (var client = new Amazon.SQS.AmazonSQSClient(accessKey, secretKey, region))
            {
                var queueUrlResult = await client.GetQueueUrlAsync(queueName, token);

                var queueUrl = queueUrlResult.QueueUrl;

                var req = new SendMessageRequest(queueUrl, message);
                if (isFIFO)
                {
                    // required
                    req.MessageGroupId         = "group";
                    req.MessageDeduplicationId = message;
                }
                req.MessageAttributes.Add("CorrelationID", new MessageAttributeValue()
                {
                    DataType    = "string",
                    StringValue = Guid.NewGuid().ToString()
                });
                //req.DelaySeconds = 10;

                var r = await client.SendMessageAsync(req);

                Console.WriteLine("[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff") + "] [P] " + message + " | " + r.MessageId);
            }
        }
All Usage Examples Of Amazon.SQS.AmazonSQSClient::GetQueueUrlAsync
AmazonSQSClient