本文整理汇总了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);
}
示例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);
}
示例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();
}
}