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


C# Model.SendMessageRequest类代码示例

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


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

示例1: ExecuteTask

 /// <summary>Run the NAnt task</summary>
 protected override void ExecuteTask()
 {
     var urlIsSet = !String.IsNullOrEmpty(QueueUrl);
     // Ensure the queue exists
     if (!DoesQueueExist())
         CreateQueue();
     // Ensure the queue URL was set
     if (!urlIsSet) {
         Project.Log(Level.Info, "Please set the queue URL: 'url=\"{0}\"'", QueueUrl);
         return;
     }
     Project.Log(Level.Info, "Sending message to queue...");
     using (Client) {
         try {
             var request = new SendMessageRequest {
                 QueueUrl = QueueUrl,
                 MessageBody = Message
             };
             Client.SendMessage(request);
         } catch (AmazonS3Exception ex) {
             ShowError(ex);
         }
     }
     Project.Log(Level.Info, "Successfully sent message to Amazon SQS!");
 }
开发者ID:lfagan,项目名称:Amazon-AWS-NAnt-Tasks,代码行数:26,代码来源:AmazonSQSTask.cs

示例2: RequestToBody

 public void RequestToBody()
 {
     var entity = new GetChangedEmployeesRequest() { LastChangeDate = fixedDate, ResponseQueueUrl = fixedQueueName };
     var message = new SendMessageRequest();
     message.RequestToBody(entity);
     Assert.AreEqual(fixedBody, message.MessageBody);
 }
开发者ID:qwert789,项目名称:codegallery,代码行数:7,代码来源:SendMessageRequestExtensionsTest.cs

示例3: AssignTaskToPeasant

 private async Task AssignTaskToPeasant() {
     var sendMsgRequest = new SendMessageRequest();
     sendMsgRequest.QueueUrl = queueURL;
     var msgData = RetrievePeasantTask();
     sendMsgRequest.MessageBody = JsonConvert.SerializeObject(msgData);
     await sqsClient.SendMessageAsync(sendMsgRequest);
 }
开发者ID:tyh24647,项目名称:Assignment_8_v2,代码行数:7,代码来源:Program.cs

示例4: EndProcessing

        protected override void EndProcessing()
        {
            AmazonSQS client = base.GetClient();

            foreach (string message in this.Messages)
            {
                try
                {
                    SendMessageRequest request = new SendMessageRequest();
                    request.QueueUrl = this.QueueUrl;
                    request.MessageBody = message;

                    SendMessageResponse response = client.SendMessage(request);
                    WriteObject(response.SendMessageResult);
                }
                catch (Exception ex)
                {
                    ErrorRecord record = new ErrorRecord(ex, null, ErrorCategory.InvalidOperation, message);
                    WriteError(record);
                }
            }


            base.EndProcessing();
        }
开发者ID:ksikes,项目名称:Amazon.Powershell,代码行数:25,代码来源:SendMessageCmdLet.cs

示例5: ToBody_Flush

 public void ToBody_Flush()
 {
     var entity = new FlushDataStoreRequest() { StoreIdentifier="Sixeyed-CloudServiceBus-ResponseData", ResponseQueueUrl = fixedQueueName };
     var message = new SendMessageRequest();
     message.RequestToBody(entity);
     var expected = @"{""ResponseQueueName"":""b1a84e89-e5b9-4720-9235-dcf9605a59c3"",""ServiceRequestName"":""FlushDataStoreRequest"",""StoreIdentifier"":""Sixeyed-CloudServiceBus-ResponseData""}";
     Assert.AreEqual(expected, message.MessageBody);
 }
开发者ID:qwert789,项目名称:codegallery,代码行数:8,代码来源:SendMessageRequestExtensionsTest.cs

示例6: Send

        public bool Send(SendMessageRequest request)
        {
            if (request == null)
                return false;

            var response = SqsClient.SendMessage(request);
            return response != null;
        }
开发者ID:derFunk,项目名称:ServiceStack.Aws,代码行数:8,代码来源:SqsMqBufferNonBuffered.cs

示例7: Send

 public static string Send(string queue_url, string msg)
 {
     AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient();
     SendMessageRequest msgreq = new SendMessageRequest();
     msgreq.QueueUrl = queue_url;
     msgreq.MessageBody = msg;
     SendMessageResponse msgres = sqs.SendMessage(msgreq);
     SendMessageResult msgrst = msgres.SendMessageResult;
     return msgrst.ToString();
 }
开发者ID:rs-services,项目名称:RightGridWindowsImplementation,代码行数:10,代码来源:Queue.cs

示例8: Search

        public string Search(string term)
        {
            var sqs = AWSClientFactory.CreateAmazonSQSClient();
            var sendMessageRequest = new SendMessageRequest();
            sendMessageRequest.QueueUrl = "https://sqs.us-west-2.amazonaws.com/x"; //URL from initial queue creation
            sendMessageRequest.MessageBody = term.ToLower().Trim();
            var sentMsg = sqs.SendMessage(sendMessageRequest);

            return sentMsg.SendMessageResult.MessageId;
        }
开发者ID:karthik20522,项目名称:EventViewer,代码行数:10,代码来源:HomeController.cs

示例9: AddToQueue

 private void AddToQueue(string data)
 {
     var sendMessageRequest = new SendMessageRequest
     {
         QueueUrl = QueueUrl,
         MessageBody = data
     };
     var response = _sqsClient.SendMessage(sendMessageRequest);
     Console.WriteLine("Response status code: " + response.HttpStatusCode);
 }
开发者ID:pierskarsenbarg,项目名称:sqs-demo,代码行数:10,代码来源:QueueSenderHelper.cs

示例10: btnSend_Click

        private void btnSend_Click(object sender, EventArgs e)
        {
            var message = SerializeEmail();
            var request = new SendMessageRequest(
                queueUrl: _awsConfig.QueueUrl,
                messageBody: message);

            var client = _awsConfig.CreateSQSClient();
            var response = client.SendMessage(request);

            MessageBox.Show("Sent message. Id: " + response.MessageId);
        }
开发者ID:sbulluk,项目名称:BlogSample-AWS-SQS,代码行数:12,代码来源:Form1.cs

示例11: Enqueue

        public void Enqueue(string data)
        {
            if (_queueUrl == null) {
                Create_queue();
            }

            var sendMessageRequest = new SendMessageRequest {
                QueueUrl = _queueUrl,
                MessageBody = data
            };
            _sqs.SendMessage(sendMessageRequest);
        }
开发者ID:ralfw,项目名称:appzwitschern,代码行数:12,代码来源:SQSOperations.cs

示例12: SendBuffer

        /// <summary>
        /// Sends the events.
        /// </summary>
        /// <param name="events">The events that need to be send.</param>
        /// <remarks>
        /// <para>
        /// The subclass must override this method to process the buffered events.
        /// </para>
        /// </remarks>
        protected override void SendBuffer(LoggingEvent[] events)
        {
            Parallel.ForEach(events, l =>
                {
                    SendMessageRequest request =
                        new SendMessageRequest()
                            .WithMessageBody(Utility.GetXmlString(l))
                            .WithQueueUrl(QueueUrl);

                    Client.SendMessage(request);
                });
        }
开发者ID:mstueck,项目名称:log4net.aws,代码行数:21,代码来源:SQSAppender.cs

示例13: Add

        public virtual AddQueueResponse Add(InstrumentMarketDataRequest request)
        {
            this.CheckRequestForValidity(request);

            var client = this.GetClient();
            var messageBody = this.GetMessageBody(request);
            var sendMessageRequest = new SendMessageRequest
                                         {
                                             MessageBody = messageBody,
                                         };
            var response = client.SendMessage(sendMessageRequest);
            return this.Convert(response);
        }
开发者ID:jrolstad,项目名称:Motore,代码行数:13,代码来源:MarketDataRequestQueue.cs

示例14: Main

        static void Main(string[] args)
        {
            Console.Title = "CloudServiceBus: Client";

            AmazonSQS sqs = AwsFacade.GetSqsClient();
            var requestQueueUrl = ConfigurationManager.AppSettings["QueueUrl"];

            //create a queue for responses:
            var queueName = Guid.NewGuid().ToString();
            var createQueueRequest = new CreateQueueRequest();
            createQueueRequest.QueueName = queueName;
            var createQueueResponse = sqs.CreateQueue(createQueueRequest);
            var responseQueueUrl = createQueueResponse.CreateQueueResult.QueueUrl;

            var listener = new MessageListener();
            ThreadPool.QueueUserWorkItem(new WaitCallback(listener.StartListening), responseQueueUrl);

            Console.WriteLine("*");
            Console.WriteLine("Sending messages on URL: {0}", requestQueueUrl);
            Console.WriteLine("Receiving responses on URL: {0}", responseQueueUrl);
            Console.WriteLine("*");

            var messageBody = Console.ReadLine();
            while (messageBody != "x")
            {
                var parts = messageBody.Split(' ');
                if (parts[0] == "get")
                {
                    var duration = int.Parse(parts[1]);
                    var serviceRequest = new GetChangedEmployeesRequest();
                    serviceRequest.LastChangeDate = DateTime.Now.AddDays(duration).Date;
                    serviceRequest.ResponseQueueUrl = responseQueueUrl;
                    var request = new SendMessageRequest();
                    request.QueueUrl = requestQueueUrl;
                    request.RequestToBody(serviceRequest);
                    SendMessage(request, sqs, serviceRequest);
                }
                if (parts[0] == "flush")
                {
                    var serviceRequest = new FlushDataStoreRequest();
                    serviceRequest.StoreIdentifier = "Sixeyed-CloudServiceBus-ResponseData";
                    var request = new SendMessageRequest();
                    request.QueueUrl = requestQueueUrl;
                    request.RequestToBody(serviceRequest);
                    SendMessage(request, sqs, serviceRequest);
                }

                messageBody = Console.ReadLine();
            }
        }
开发者ID:qwert789,项目名称:codegallery,代码行数:50,代码来源:Program.cs

示例15: SendMessage

        public static void SendMessage(string typeName,Func<object> messageComposer)
        {
           
            Task.Factory.StartNew(() => {
                EnsureQueue();
                Logger.Debug("starting sync message...");
                SendMessageRequest sendMessageRequest = new SendMessageRequest();
                sendMessageRequest.QueueUrl = queueUrl;
                sendMessageRequest.MessageBody = JsonConvert.SerializeObject(new { type = typeName, data = messageComposer() });

                sqs.SendMessage(sendMessageRequest);
                Logger.Debug("completed one message sync");
            });
           
        }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:15,代码来源:AwsHelper.cs


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