当前位置: 首页>>代码示例>>C#>>正文


C# AmazonSQSClient.DeleteQueue方法代码示例

本文整理汇总了C#中Amazon.SQS.AmazonSQSClient.DeleteQueue方法的典型用法代码示例。如果您正苦于以下问题:C# AmazonSQSClient.DeleteQueue方法的具体用法?C# AmazonSQSClient.DeleteQueue怎么用?C# AmazonSQSClient.DeleteQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Amazon.SQS.AmazonSQSClient的用法示例。


在下文中一共展示了AmazonSQSClient.DeleteQueue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: When_obtaining_details_on_a_message_queue

        public void When_obtaining_details_on_a_message_queue(string queueName, bool exists)
        {
            // Arrange
            var client = new AmazonSQSClient("access key", "secret key");

            if (exists)
            {
                client.CreateQueue(new CreateQueueRequest().WithQueueName(queueName));
            }
            else
            {
                var response = client.ListQueues(new ListQueuesRequest().WithQueueNamePrefix(queueName));
                if (response.ListQueuesResult.QueueUrl.Any())
                {
                    client.DeleteQueue(new DeleteQueueRequest().WithQueueUrl(response.ListQueuesResult.QueueUrl.First()));
                }
            }

            Thread.Sleep(2000); // Give the queues some time to spin up
          
            var factory = new AmazonSqsMessageQueueDetailFactory(client);


            // Act
            var result = factory.Build<TestMessage>(queueName);

            // Assert
            Assert.That(result.Uri, Is.StringContaining(queueName));
            Assert.That(result.Exists, Is.EqualTo(exists));
        }  
开发者ID:jrolstad,项目名称:Simple.Messaging,代码行数:30,代码来源:AmazonSqsMessageQueueDetailFactoryTests.cs

示例2: DeleteQueueByQueueUrl

 public static void DeleteQueueByQueueUrl(string queueUrl)
 {
     using (var client = new AmazonSQSClient(Settings.AccessKey, Settings.Secret))
     {
         client.DeleteQueue(queueUrl);
     }
 }
开发者ID:korz,项目名称:IntroductionToAmazonAws,代码行数:7,代码来源:Repository.cs

示例3: DeleteQueue

 public virtual void DeleteQueue(AmazonSQSClient sqsClient, string queueUrl)
 {
     var deleteQueueRequest = new DeleteQueueRequest
     {
         QueueUrl = queueUrl
     };
     // Delete the queue
     sqsClient.DeleteQueue(deleteQueueRequest);
 }
开发者ID:jfaerman,项目名称:devonaws-labs-csharp,代码行数:9,代码来源:SolutionCode.cs

示例4: DeleteAllQueues

        public static void DeleteAllQueues()
        {
            using (var client = new AmazonSQSClient(Settings.AccessKey, Settings.Secret))
            {
                var response = client.ListQueues(new ListQueuesRequest());

                foreach (var queueUrl in response.QueueUrls)
                {
                    PurgeQueueByQueueUrl(queueUrl);

                    client.DeleteQueue(queueUrl);
                }
            }
        }
开发者ID:korz,项目名称:IntroductionToAmazonAws,代码行数:14,代码来源:Repository.cs

示例5: Messages_are_queued

        public void Messages_are_queued()
        {
            var client = new AmazonSQSClient(ConfigurationManager.AppSettings["AWSKey"], ConfigurationManager.AppSettings["AWSSecret"]);
            var queue = Guid.NewGuid().ToString();
            var consumer = new SimpleQueueConsumer<StringEvent>(client, queue);
            var block = new AutoResetEvent(false);
            
            var producer = new ObservingProducer<StringEvent>();
            producer.Attach(consumer);
            producer.Produces(GetPayload().ToObservable());
            producer.Start();

            block.WaitOne(TimeSpan.FromSeconds(5));
            client.DeleteQueue(new DeleteQueueRequest().WithQueueUrl(consumer.QueueUrl));
        }
开发者ID:modulexcite,项目名称:graveyard,代码行数:15,代码来源:SimpleQueueConsumerTests.cs

示例6: Messages_are_dequeued

        public void Messages_are_dequeued()
        {
            var block = new AutoResetEvent(false);
            var sent = 10;
            var received = 0;

            var serializer = new JsonSerializer();
            var key = ConfigurationManager.AppSettings["AWSKey"];
            var secret = ConfigurationManager.AppSettings["AWSSecret"];
            var queueName = Guid.NewGuid().ToString();

            var client = new AmazonSQSClient(key, secret);

            // Anything put into the queue will go to Amazon SQS
            var queue = new ConcurrentQueue<StringEvent>();
            var consumer = new SimpleQueueConsumer<StringEvent>(client, queueName);
            new CollectionProducer<StringEvent>(queue).Consumes(consumer).Start();

            // Anything taken from Amazon SQS goes to the console
            new SimpleQueueProducer<StringEvent>(client, queueName, serializer).Consumes(new DelegatingConsumer<StringEvent>(@event =>
            {
                Console.WriteLine(@event.Text);
                received++;
                if (received >= sent)
                {
                    block.Set();
                }
            })).Start();

            // Make some messages
            queue.Enqueue(new StringEvent("Test1"));
            queue.Enqueue(new StringEvent("Test2"));
            queue.Enqueue(new StringEvent("Test3"));
            queue.Enqueue(new StringEvent("Test4"));
            queue.Enqueue(new StringEvent("Test5"));
            queue.Enqueue(new StringEvent("Test6"));
            queue.Enqueue(new StringEvent("Test7"));
            queue.Enqueue(new StringEvent("Test8"));
            queue.Enqueue(new StringEvent("Test9"));
            queue.Enqueue(new StringEvent("Test10"));

            block.WaitOne();

            client.DeleteQueue(new DeleteQueueRequest().WithQueueUrl(consumer.QueueUrl));
        }
开发者ID:modulexcite,项目名称:graveyard,代码行数:45,代码来源:SimpleQueueProducerTests.cs

示例7: DeleteQueue

 public void DeleteQueue()
 {
     using (var client = new AmazonSQSClient(_accessKeyId, _secretAccessKey, _regionEndpoint))
     {
         client.DeleteQueue(_queueUrl);
     }
 }
开发者ID:netojoaop,项目名称:Rebus,代码行数:7,代码来源:AmazonSQSTransport.cs

示例8: DeleteQueue

 public void DeleteQueue()
 {
     using (var client = new AmazonSQSClient(_accessKeyId, _secretAccessKey, _amazonSqsConfig))
     {
         client.DeleteQueue(_queueUrl);
     }
 }
开发者ID:RichieYang,项目名称:Rebus,代码行数:7,代码来源:AmazonSQSTransport.cs

示例9: SetQueueConfigurationTests

        public void SetQueueConfigurationTests()
        {
            var filterRule = new FilterRule("Prefix", "test/");
            var s3Config = new AmazonS3Config();
            using (var s3Client = new AmazonS3Client(s3Config))
            using (var sqsClient = new AmazonSQSClient())
            {
                var createResponse = sqsClient.CreateQueue("events-test-" + DateTime.Now.Ticks);
                var bucketName = S3TestUtils.CreateBucket(s3Client);
                try
                {
                    var queueArn = sqsClient.AuthorizeS3ToSendMessage(createResponse.QueueUrl, bucketName);

                    PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest
                    {
                        BucketName = bucketName,
                        QueueConfigurations = new List<QueueConfiguration>
                        {
                            new QueueConfiguration
                            {
                                Id = "the-queue-test",
                                Queue = queueArn,
                                Events = {EventType.ObjectCreatedPut},
                                Filter = new Filter
                                {
                                    S3KeyFilter = new S3KeyFilter
                                    {
                                        FilterRules = new List<FilterRule> 
                                        {
                                            filterRule
                                        }
                                    }
                                }
                            }
                        }
                    };

                    s3Client.PutBucketNotification(putRequest);

                    var getResponse = s3Client.GetBucketNotification(bucketName);

                    Assert.AreEqual(1, getResponse.QueueConfigurations.Count);
                    Assert.AreEqual(1, getResponse.QueueConfigurations[0].Events.Count);
                    Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.QueueConfigurations[0].Events[0]);

                    Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter);
                    Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter.S3KeyFilter);
                    Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules);
                    Assert.AreEqual(1, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules.Count);
                    Assert.AreEqual(filterRule.Name, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules[0].Name);
                    Assert.AreEqual(filterRule.Value, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules[0].Value);

                    Assert.AreEqual("the-queue-test", getResponse.QueueConfigurations[0].Id);
                    Assert.AreEqual(queueArn, getResponse.QueueConfigurations[0].Queue);

                    // Purge queue to remove test message sent configuration was setup.
                    sqsClient.PurgeQueue(createResponse.QueueUrl);
                    Thread.Sleep(TimeSpan.FromSeconds(1));

                    var putObjectRequest = new PutObjectRequest
                    {
                        BucketName = bucketName,
                        Key = "test/data.txt",
                        ContentBody = "Important Data"
                    };

                    s3Client.PutObject(putObjectRequest);

                    string messageBody = null;
                    for (int i = 0; i < 5 && messageBody == null; i++)
                    {
                        var receiveResponse = sqsClient.ReceiveMessage(new ReceiveMessageRequest { QueueUrl = createResponse.QueueUrl, WaitTimeSeconds = 20 });
                        if (receiveResponse.Messages.Count != 0)
                        {
                            messageBody = receiveResponse.Messages[0].Body;
                        }
                    }


                    var evnt = S3EventNotification.ParseJson(messageBody);

                    Assert.AreEqual(1, evnt.Records.Count);
                    Assert.AreEqual(putObjectRequest.BucketName, evnt.Records[0].S3.Bucket.Name);
                    Assert.AreEqual(putObjectRequest.Key, evnt.Records[0].S3.Object.Key);
                    Assert.AreEqual(putObjectRequest.ContentBody.Length, evnt.Records[0].S3.Object.Size);
                }
                finally
                {
                    sqsClient.DeleteQueue(createResponse.QueueUrl);
                    AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName);
                }
            }
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:93,代码来源:NotificationTests.cs

示例10: SQSDeleteQueue

    public static void SQSDeleteQueue()
    {
      #region SQSDeleteQueue
      var client = new AmazonSQSClient();

      var request = new DeleteQueueRequest
      {
        QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue"
      };

      client.DeleteQueue(request);
      #endregion
    }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:13,代码来源:SQSSamples.cs


注:本文中的Amazon.SQS.AmazonSQSClient.DeleteQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。