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


C# SendMessageRequest.RequestToBody方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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


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