• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Model.ReceiveMessageRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Amazon.SQS.Model.ReceiveMessageRequest的典型用法代码示例。如果您正苦于以下问题:C# ReceiveMessageRequest类的具体用法?C# ReceiveMessageRequest怎么用?C# ReceiveMessageRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReceiveMessageRequest类属于Amazon.SQS.Model命名空间,在下文中一共展示了ReceiveMessageRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Get_Msg_From_Req_Q

        public static bool Get_Msg_From_Req_Q(out Amazon.SQS.Model.Message msg, out bool msgFound)
        {
            msgFound = false;
            msg = null;
            try
            {
                ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
                receiveMessageRequest.MaxNumberOfMessages = 1;
                receiveMessageRequest.QueueUrl = requests_Q_url;
                ReceiveMessageResponse receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
                if (receiveMessageResponse.IsSetReceiveMessageResult())
                {
                    ReceiveMessageResult receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                    List<Amazon.SQS.Model.Message> receivedMsges = receiveMessageResponse.ReceiveMessageResult.Message;
                    if (receivedMsges.Count == 0)
                    {
                        return true;
                    }
                    msgFound = true;
                    msg = receivedMsges[0];
                }

            }
            catch (AmazonSQSException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                return false;
            }
            return true;
        }
开发者ID:tamirez3dco,项目名称:Rendering_Code,代码行数:35,代码来源:SQS.cs


示例2: ReceiveMessage

        private void ReceiveMessage()
        {
            var receiveMessageRequest = new ReceiveMessageRequest();
            receiveMessageRequest.QueueUrl = _handler.QueueUrl;
            var receiveMessageResponse = _sqsClient.ReceiveMessage(receiveMessageRequest);
            if (receiveMessageResponse.IsSetReceiveMessageResult() && receiveMessageResponse.ReceiveMessageResult.Message.Count > 0)
            {
                Console.WriteLine("Received message");
                var receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                foreach (Message message in receiveMessageResult.Message)
                {
                    Console.WriteLine("Message body: {0}", message.Body);
                    foreach (var handler in Container.GetAll<IServiceHandler>())
                    {
                        //TODO - need to refactor this, multiple handlers means multiple deserialization
                        if (handler.QueueName == _handler.QueueName && handler.IsRequestHandled(message))
                        {
                            Console.WriteLine("Passing request to handler: {0}", handler.GetType().Name);
                            handler.HandleRequest(message);
                        }
                    }
                }

                Console.WriteLine("Deleting message");
                var messageRecieptHandle = receiveMessageResponse.ReceiveMessageResult.Message[0].ReceiptHandle;
                var deleteRequest = new DeleteMessageRequest()
                                            .WithQueueUrl(_handler.QueueUrl)
                                            .WithReceiptHandle(messageRecieptHandle);
                _sqsClient.DeleteMessage(deleteRequest);
            }
        }
开发者ID:qwert789,项目名称:codegallery,代码行数:31,代码来源:MessageListener.cs


示例3: GetMessage

        public async Task<Amazon.SQS.Model.Message> GetMessage(string queueName, int  timeoutInMilliseconds, int numberOfCacheableMessages)
        {
            Amazon.SQS.Model.Message message = null;
            if (_queue.ContainsKey(queueName) && _queue[queueName].TryDequeue(out message)) return message;
            
            var request = new ReceiveMessageRequest(queueName)
            {
                MaxNumberOfMessages = numberOfCacheableMessages,
                WaitTimeSeconds = (int)TimeSpan.FromMilliseconds(timeoutInMilliseconds).TotalSeconds
            };

            using (var client = new AmazonSQSClient(_credentials))
            {
                var response = await client.ReceiveMessageAsync(request);
                                
                if (response.HttpStatusCode != HttpStatusCode.OK) return message;

                if (response.ContentLength == 0) return message;

                if (!response.Messages.Any()) return message;

                AddToQueue(queueName, response.Messages);

                if(_queue.ContainsKey(queueName))
                    _queue[queueName].TryDequeue(out message);
            }

            return message;
        }
开发者ID:iancooper,项目名称:Paramore,代码行数:29,代码来源:SqsQueuedRetriever.cs


示例4: readNextMessage

        /// <summary>
        /// Poll messages from the queue.  Given the download process takes many hours there is extra
        /// long retry logic.
        /// </summary>
        /// <returns>The next message in the queue;</returns>
        Message readNextMessage()
        {
            int retryAttempts = 0;
            var receiveRequest = new ReceiveMessageRequest() { QueueUrl = this.queueUrl, MaxNumberOfMessages = 1 };
            while (true)
            {
                try
                {
                    var receiveResponse = this.sqsClient.ReceiveMessage(receiveRequest);
                    retryAttempts = 0;

                    if (receiveResponse.Messages.Count == 0)
                    {
                        Thread.Sleep((int)(this.options.PollingInterval * 1000 * 60));
                        continue;
                    }

                    return receiveResponse.Messages[0];
                }
                catch (Exception)
                {
                    retryAttempts++;
                    if (retryAttempts <= MAX_OPERATION_RETRY)
                        Thread.Sleep(60 * 1000);
                    else
                        throw;
                }
            }
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:34,代码来源:DownloadFileCommand.bcl.cs


示例5: readNextMessageAsync

        /// <summary>
        /// Poll messages from the queue.  Given the download process takes many hours there is extra
        /// long retry logic.
        /// </summary>
        /// <returns>The next message in the queue;</returns>
        async Task<Message> readNextMessageAsync()
        {
            int retryAttempts = 0;
            var receiveRequest = new ReceiveMessageRequest() { QueueUrl = this.queueUrl, MaxNumberOfMessages = 1 };
            while (true)
            {
                try
                {
                    var receiveResponse = await this.sqsClient.ReceiveMessageAsync(receiveRequest).ConfigureAwait(false);
                    retryAttempts = 0;

                    if (receiveResponse.Messages.Count == 0)
                    {
                        await Task.Delay((int)(this.options.PollingInterval * 1000 * 60)).ConfigureAwait(false);
                        continue;
                    }

                    return receiveResponse.Messages[0];
                }
                catch (Exception)
                {
                    retryAttempts++;
                    if (retryAttempts <= MAX_OPERATION_RETRY)
                        Task.Delay(1000 * 60).Wait();
                    else
                        throw;
                }
            }
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:34,代码来源:DownloadFileCommand.async.cs


示例6: Next

      public IMessage Next(int timeout)
      {
         try
         {
            var request = new ReceiveMessageRequest()
            {
               MaxNumberOfMessages = 1,
               QueueName = Name,
               VisibilityTimeout = timeout
            };

            var response = _client.ReceiveMessage(request);

            var message = response.ReceiveMessageResult.Message.SingleOrDefault();

            if (message == null)
               return null;

            return new AmazonMessage { Content = message.Body, Message = message };
         }
         catch (AmazonSQSException e)
         {
            throw new MessageQueueException(string.Format("Failed to get next message for '{0}'.", Name), e);
         }
      }
开发者ID:trevorpower,项目名称:tadmap,代码行数:25,代码来源:MessageQueue.cs


示例7: GetNextMessage

        public AlertMessage GetNextMessage()
        {
            //Receiving a message
            ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
            receiveMessageRequest.QueueUrl = queueUrl;
            ReceiveMessageResponse receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
            if (receiveMessageResponse.IsSetReceiveMessageResult())
            {
                Console.WriteLine("Printing received message.\n");
                ReceiveMessageResult receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                foreach (Message message in receiveMessageResult.Message)
                {
                    AlertMessage m = new AlertMessage();
                    Console.WriteLine("  Message");
                    if (message.IsSetMessageId())
                    {
                        Console.WriteLine("    MessageId: {0}", message.MessageId);
                    }
                    if (message.IsSetReceiptHandle())
                    {
                        Console.WriteLine("    ReceiptHandle: {0}", message.ReceiptHandle);
                    }
                    if (message.IsSetMD5OfBody())
                    {
                        Console.WriteLine("    MD5OfBody: {0}", message.MD5OfBody);
                    }
                    if (message.IsSetBody())
                    {
                        m.Body = message.Body;
                        Console.WriteLine("    Body: {0}", message.Body);
                    }
                    foreach (Amazon.SQS.Model.Attribute attribute in message.Attribute)
                    {
                        Console.WriteLine("  Attribute");
                        if (attribute.IsSetName() && attribute.Name == "Subject")
                        {
                            if (attribute.IsSetValue())
                            {
                                m.Subject = attribute.Value;
                            }
                        }
                        if (attribute.IsSetValue())
                        {
                            Console.WriteLine("    Value: {0}", attribute.Value);
                        }
                    }

                    // Deleting a message
                    Console.WriteLine("Deleting the message.\n");
                    DeleteMessageRequest deleteRequest = new DeleteMessageRequest();
                    deleteRequest.QueueUrl = queueUrl;
                    deleteRequest.ReceiptHandle = message.ReceiptHandle;
                    sqs.DeleteMessage(deleteRequest);

                    return m;
                }
            }
            return null;
        }
开发者ID:mloar,项目名称:sirisx,代码行数:59,代码来源:AmazonSQSMessageRetrievalInterface.cs


示例8: GetRequests

 public virtual List<CombinedMarketDataRequest> GetRequests()
 {
     var client = this.GetClient();
     var queueReceiveRequest = new ReceiveMessageRequest
                                   {
                                       MaxNumberOfMessages = 10,
                                   };
     var response = client.ReceiveMessage(queueReceiveRequest);
     return Convert(response);
 }
开发者ID:jrolstad,项目名称:Motore,代码行数:10,代码来源:MarketDataRequestQueue.cs


示例9: Receive

        public Message Receive(ReceiveMessageRequest request)
        {
            if (request == null)
                return null;

            request.MaxNumberOfMessages = 1;

            var response = SqsClient.ReceiveMessage(request);

            return response == null
                ? null
                : response.Messages.SingleOrDefault();
        }
开发者ID:derFunk,项目名称:ServiceStack.Aws,代码行数:13,代码来源:SqsMqBufferNonBuffered.cs


示例10: Main

        static void Main(string[] args)
        {
            // AWS: Get instance public address
            string myId = "localhost";
            try
            {
                myId = Encoding.ASCII.GetString(new WebClient().DownloadData("http://169.254.169.254/latest/meta-data/public-hostname"));
            }
            catch
            {
            }

            // AWS SQS Client
            var sqsClient = new AmazonSQSClient();

            while (true)
            {
                // Get the next message
                ReceiveMessageRequest request = new ReceiveMessageRequest()
                    .WithQueueUrl("https://queue.amazonaws.com/*****/codeCampDemo")
                    .WithMaxNumberOfMessages(1);
                var response = sqsClient.ReceiveMessage(request);

                foreach (var retrievedMessage in response.ReceiveMessageResult.Message)
                {
                    var messageJson = JsonValue.Parse(retrievedMessage.Body);

                    var message = messageJson["message"].ReadAs<string>();

                    Console.WriteLine(message);

                    message = "Echo: " + message;

                    string address = string.Format("http://{0}", messageJson["sender"].ReadAs<string>());
                    var connection = new HubConnection(address);
                    connection.Start().Wait();

                    IHubProxy pongHub = connection.CreateProxy("MvcWebRole1.Hubs.EchoHub");
                    pongHub.Invoke("DoUpdateMessage", message, myId).Wait();

                    //Process the message and then delete the message
                    DeleteMessageRequest deleteRequest = new DeleteMessageRequest()
                        .WithQueueUrl("https://queue.amazonaws.com/******/codeCampDemo")
                        .WithReceiptHandle(retrievedMessage.ReceiptHandle);
                    sqsClient.DeleteMessage(deleteRequest);
                }

                Thread.Sleep(1000);
            }
        }
开发者ID:igormoochnick,项目名称:EndToEndDistributedAppAws,代码行数:50,代码来源:WorkerRole.cs


示例11: MessageGearsAwsQueuePoller

 /// <summary>
 /// Instantiates the Poller.
 /// </summary>
 /// <param name="props">
 /// A <see cref="MessageGearsProperties"/>
 /// </param>
 /// <param name="listener">
 /// A <see cref="MessageGearsListener"/>
 /// </param>
 /// <param name="myAwsAccountKey">
 /// You AWS Account Key
 /// </param>
 /// <param name="myAwsSecretKey">
 /// Your AWS Secret Key
 /// </param>
 public MessageGearsAwsQueuePoller(MessageGearsAwsProperties props, MessageGearsListener listener)
 {
     this.props = props;
     this.emptyQueueDelayMillis = props.EmptyQueuePollingDelaySecs * 1000;
     this.listener = listener;
     AmazonSQSConfig config = new AmazonSQSConfig().WithMaxErrorRetry(props.SQSMaxErrorRetry);
     this.sqs = AWSClientFactory.CreateAmazonSQSClient (props.MyAWSAccountKey, props.MyAWSSecretKey, config);
     this.receiveMessageRequest = new ReceiveMessageRequest ()
         .WithQueueUrl (props.MyAWSEventQueueUrl)
         .WithMaxNumberOfMessages (props.SQSMaxBatchSize)
         .WithAttributeName("ApproximateReceiveCount")
         .WithVisibilityTimeout(props.SQSVisibilityTimeoutSecs);
     this.deleteMessageRequest = new DeleteMessageRequest().WithQueueUrl(props.MyAWSEventQueueUrl);
 }
开发者ID:messagegears,项目名称:messagegears-csharp-aws-sdk,代码行数:29,代码来源:MessageGearsAwsQueuePoller.cs


示例12: ReadFromQueue

        static void ReadFromQueue(AWSCredentials credentials)
        {
            AmazonSQSClient client = new AmazonSQSClient(credentials, RegionEndpoint.USEast1);

            string queueUrl = "https://sqs.us-east-1.amazonaws.com/025631894481/aws-talk";

            ReceiveMessageRequest request = new ReceiveMessageRequest(queueUrl);
            request.MaxNumberOfMessages = 1;
            ReceiveMessageResponse response = client.ReceiveMessage(request);

            foreach (var message in response.Messages)
            {
                // Do something with the message
            }
        }
开发者ID:modulexcite,项目名称:2015-Slides-and-Demos,代码行数:15,代码来源:Program.cs


示例13: Get

 public static Message Get(string queue_url)
 {
     AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient();
     ReceiveMessageRequest r_msgreq = new ReceiveMessageRequest();
     r_msgreq.MaxNumberOfMessages = 1;
     r_msgreq.QueueUrl = queue_url;
     Decimal Vis_Timeout = System.Convert.ToDecimal(ConfigurationManager.AppSettings["SQS_Visibility"]);
     r_msgreq.VisibilityTimeout = Vis_Timeout;
     ReceiveMessageResponse r_msgres = sqs.ReceiveMessage(r_msgreq);
     //ChangeMessageVisibilityRequest chg_message_vis = new ChangeMessageVisibilityRequest();
     //chg_message_vis.QueueUrl = ConfigurationManager.AppSettings["SQSUrl"];
     //chg_message_vis.ReceiptHandle = r_msgres.ResponseMetadata.RequestId
     ReceiveMessageResult r_msgrst = r_msgres.ReceiveMessageResult;
     Message msg = r_msgrst.Message.FirstOrDefault();
     return msg;
 }
开发者ID:rs-services,项目名称:RightGridWindowsImplementation,代码行数:16,代码来源:Queue.cs


示例14: Receive

        private static ReceivedMessage Receive()
        {
            var request = new ReceiveMessageRequest
                {
                    QueueUrl = _awsConfig.QueueUrl,
                    MaxNumberOfMessages = 1
                };
            var response = _client.ReceiveMessage(request);

            if (response.Messages.Count == 0) return null;
            var message = response.Messages[0];
            var json = message.Body;
            return new ReceivedMessage
                {
                    Email = JsonConvert.DeserializeObject<EmailMessage>(json),
                    ReceiptHandle = message.ReceiptHandle
                };
        }
开发者ID:sbulluk,项目名称:BlogSample-AWS-SQS,代码行数:18,代码来源:Program.cs


示例15: ListTop10Messages

        public List<QueueMessage> ListTop10Messages(string queueUrl)
        {
            var req = new ReceiveMessageRequest() {
                MaxNumberOfMessages = 10,
                QueueUrl = queueUrl
            };

            req.AttributeName.Add("SentTimestamp");
            req.AttributeName.Add("ApproximateReceiveCount");
            req.AttributeName.Add("ApproximateFirstReceiveTimestamp");

            var result = new List<QueueMessage>(10);
            var response = client.ReceiveMessage(req);
            if (response.IsSetReceiveMessageResult() && response.ReceiveMessageResult.IsSetMessage()) {
                DateTime epochDate = new DateTime(1970,1,1,0,0,0,DateTimeKind.Utc);
                foreach (Message msg in response.ReceiveMessageResult.Message) {
                    var qm = new QueueMessage() {
                        Body = msg.Body,
                        ReceiptHandle = msg.ReceiptHandle
                    };

                    if (msg.IsSetAttribute()) {
                        foreach (Amazon.SQS.Model.Attribute att in msg.Attribute) {
                            switch (att.Name) {
                                case "SentTimestamp":
                                    qm.Sent = epochDate.AddMilliseconds(double.Parse(att.Value));
                                    break;
                                case "ApproximateReceiveCount":
                                    qm.ApproximateReceiveCount = Int32.Parse(att.Value);
                                    break;
                                case "ApproximateFirstReceiveTimestamp":
                                    qm.FirstReceived = epochDate.AddMilliseconds(double.Parse(att.Value));
                                    break;
                            }
                        }
                    }

                    result.Add(qm);
                }
            }

            return result;
        }
开发者ID:RPM1984,项目名称:amazonsqs,代码行数:43,代码来源:QueueAdmin.cs


示例16: SQSReceiveMessage

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

      var request = new ReceiveMessageRequest
      {
        AttributeNames = new List<string>() { "All" },
        MaxNumberOfMessages = 5,
        QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue",
        VisibilityTimeout = (int)TimeSpan.FromMinutes(10).TotalSeconds,
        WaitTimeSeconds = (int)TimeSpan.FromSeconds(5).TotalSeconds
      };

      var response = client.ReceiveMessage(request);

      if (response.Messages.Count > 0)
      {
        foreach (var message in response.Messages)
        {
          Console.WriteLine("For message ID '" + message.MessageId + "':");
          Console.WriteLine("  Body: " + message.Body);
          Console.WriteLine("  Receipt handle: " + message.ReceiptHandle);
          Console.WriteLine("  MD5 of body: " + message.MD5OfBody);
          Console.WriteLine("  MD5 of message attributes: " +
            message.MD5OfMessageAttributes);
          Console.WriteLine("  Attributes:");

          foreach (var attr in message.Attributes)
          {
            Console.WriteLine("    " + attr.Key + ": " + attr.Value);
          }
        }
      }
      else
      {
        Console.WriteLine("No messages received.");
      }
      #endregion

      Console.ReadLine();
    }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:42,代码来源:SQSSamples.cs


示例17: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
            receiveMessageRequest.QueueUrl = myQueueUrl;
            ReceiveMessageResponse receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
            if (receiveMessageResponse.IsSetReceiveMessageResult())
            {
                ReceiveMessageResult receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                foreach (Amazon.SQS.Model.Message message in receiveMessageResult.Message)
                {
                    if (message.IsSetBody())
                     MessageBox.Show(message.Body);
                }
            }

            String messageRecieptHandle = receiveMessageResponse.ReceiveMessageResult.Message[0].ReceiptHandle;
            DeleteMessageRequest deleteRequest = new DeleteMessageRequest();
            deleteRequest.QueueUrl = myQueueUrl;
            deleteRequest.ReceiptHandle = messageRecieptHandle;
            sqs.DeleteMessage(deleteRequest);
        }
开发者ID:HappiestTeam,项目名称:Spikes,代码行数:21,代码来源:Form1.cs


示例18: ReceiveMessage

        private void ReceiveMessage()
        {
            var receiveMessageRequest = new ReceiveMessageRequest();
            receiveMessageRequest.QueueUrl = _queueUrl;
            var receiveMessageResponse = _sqsClient.ReceiveMessage(receiveMessageRequest);
            if (receiveMessageResponse.IsSetReceiveMessageResult() && receiveMessageResponse.ReceiveMessageResult.Message.Count > 0)
            {
                Console.WriteLine("Received message at: {0}", DateTime.Now.ToLongTimeString());
                var receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                foreach (Message message in receiveMessageResult.Message)
                {
                    Console.WriteLine("Message body: {0}", message.Body);
                }

                var response = receiveMessageResponse.FirstMessageAsResponse<QueryServiceResponse>();
                if (response != null)
                {
                    //fetch the data from the response store:
                    Console.WriteLine("Fetching data at: {0}", DateTime.Now.ToLongTimeString());
                    var responseItems = DataStore.Current.Fetch(response.StoreIdentifier, response.ItemKey);
                    var employees = new List<Employee>(responseItems.Count());
                    foreach (var responseItem in responseItems)
                    {
                        var employee = Serializer.Current.Deserialize(typeof(Employee), responseItem) as Employee;
                        Console.WriteLine("Adding employee - {0}", employee);
                        employees.Add(employee);
                    }
                }

                Console.WriteLine("Deleting message");
                var messageRecieptHandle = receiveMessageResponse.ReceiveMessageResult.Message[0].ReceiptHandle;
                var deleteRequest = new DeleteMessageRequest()
                                            .WithQueueUrl(_queueUrl)
                                            .WithReceiptHandle(messageRecieptHandle);
                _sqsClient.DeleteMessage(deleteRequest);
                Console.WriteLine("Completed at: {0}", DateTime.Now.ToLongTimeString());
            }
        }
开发者ID:qwert789,项目名称:codegallery,代码行数:38,代码来源:MessageListener.cs


示例19: ClaimJobs

        public override List<Job> ClaimJobs(string queue, int count)
        {
            List<Job> claimedJobs = new List<Job>();

            try
            {
                ReceiveMessageRequest request = new ReceiveMessageRequest();
                request.MaxNumberOfMessages = count;
                request.QueueUrl = GetQueueUrl(SanitiseQueueName(queue));
                ReceiveMessageResponse response = client.ReceiveMessage(request);

                for (int i = 0; i < response.ReceiveMessageResult.Message.Count; i++)
                {
                    Message message = response.ReceiveMessageResult.Message[i];
                    claimedJobs.Add(new Job(queue, message.MessageId, message.ReceiptHandle, message.Body));
                }
            }
            catch (System.Net.WebException)
            {
            }

            return claimedJobs;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:23,代码来源:AmazonSQS.cs


示例20: DequeueByQueueUrl

        public static string DequeueByQueueUrl(string queueUrl)
        {
            using (var client = new AmazonSQSClient(Settings.AccessKey, Settings.Secret))
            {
                var request = new ReceiveMessageRequest()
                {
                    QueueUrl = queueUrl
                };

                var response = client.ReceiveMessage(request).Messages.First();

                var body = response.Body;

                var deleteRequest = new DeleteMessageRequest
                {
                    QueueUrl = queueUrl,
                    ReceiptHandle = response.ReceiptHandle
                };

                client.DeleteMessage(deleteRequest);

                return body;
            }
        }
开发者ID:korz,项目名称:IntroductionToAmazonAws,代码行数:24,代码来源:Repository.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Model.SendMessageRequest类代码示例发布时间:2022-05-24
下一篇:
C# SQS.AmazonSQSConfig类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap