本文整理汇总了C#中Amazon.SQS.Model.SendMessageRequest类的典型用法代码示例。如果您正苦于以下问题:C# SendMessageRequest类的具体用法?C# SendMessageRequest怎么用?C# SendMessageRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SendMessageRequest类属于Amazon.SQS.Model命名空间,在下文中一共展示了SendMessageRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: button1_Click
private void button1_Click(object sender, EventArgs e)
{
CreateQueueRequest sqsRequest = new CreateQueueRequest();
sqsRequest.QueueName = "MYFirstQueue";
CreateQueueResponse createQueueResponse = sqs.CreateQueue(sqsRequest);
myQueueUrl = createQueueResponse.CreateQueueResult.QueueUrl;
//Confirming the queue exists
ListQueuesRequest listQueuesRequest = new ListQueuesRequest();
ListQueuesResponse listQueuesResponse = sqs.ListQueues(listQueuesRequest);
SendMessageRequest sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = myQueueUrl;
sendMessageRequest.MessageBody = txtPushMsg.Text;
sqs.SendMessage(sendMessageRequest);
}
开发者ID:HappiestTeam,项目名称:Spikes,代码行数:16,代码来源:Form1.cs
示例17: Execute
protected override bool Execute(AmazonSQS client)
{
var request = new SendMessageRequest { MessageBody = MessageBody, QueueUrl = QueueUrl };
SendMessageResponse response = client.SendMessage(request);
if (response.IsSetSendMessageResult())
{
MessageId = response.SendMessageResult.MessageId;
Logger.LogMessage(MessageImportance.Normal, "Sent message {0} to Queue {1}", MessageId, QueueUrl);
return true;
}
Logger.LogMessage(MessageImportance.High, "Message failed to send to to Queue {0}", QueueUrl);
return false;
}
开发者ID:BookSwapSteve,项目名称:AWS-MSBuild-Task-Library,代码行数:17,代码来源:SendSQSMessageTask.cs
示例18: Add
public void Add(string message)
{
try
{
SendMessageRequest request = new SendMessageRequest
{
MessageBody = message,
QueueName = Name
};
SendMessageResponse response = _client.SendMessage(request);
}
catch (AmazonSQSException e)
{
throw new MessageQueueException(string.Format("Failed to add message to '{0}'.", Name), e);
}
}
开发者ID:trevorpower,项目名称:tadmap,代码行数:17,代码来源:MessageQueue.cs
示例19: SendMessage
private void SendMessage(string message, SendOptions sendOptions)
{
var delayDeliveryBy = TimeSpan.MaxValue;
if (sendOptions.DelayDeliveryWith.HasValue)
delayDeliveryBy = sendOptions.DelayDeliveryWith.Value;
else
{
if (sendOptions.DeliverAt.HasValue)
{
delayDeliveryBy = sendOptions.DeliverAt.Value - DateTime.UtcNow;
}
}
var sendMessageRequest = new SendMessageRequest(QueueUrlCache.GetQueueUrl(sendOptions.Destination), message);
// There should be no need to check if the delay time is greater than the maximum allowed
// by SQS (15 minutes); the call to AWS will fail with an appropriate exception if the limit is exceeded.
if ( delayDeliveryBy != TimeSpan.MaxValue)
sendMessageRequest.DelaySeconds = Math.Max(0, (int)delayDeliveryBy.TotalSeconds);
SqsClient.SendMessage(sendMessageRequest);
}
开发者ID:GCMGrosvenor,项目名称:NServiceBus.AmazonSQS-1,代码行数:22,代码来源:SqsQueueSender.cs
示例20: SQSSendMessage
public static void SQSSendMessage()
{
#region SQSSendMessage
var client = new AmazonSQSClient();
var request = new SendMessageRequest
{
DelaySeconds = (int)TimeSpan.FromSeconds(5).TotalSeconds,
MessageAttributes = new Dictionary<string, MessageAttributeValue>
{
{
"MyNameAttribute", new MessageAttributeValue
{ DataType = "String", StringValue = "John Doe" }
},
{
"MyAddressAttribute", new MessageAttributeValue
{ DataType = "String", StringValue = "123 Main St." }
},
{
"MyRegionAttribute", new MessageAttributeValue
{ DataType = "String", StringValue = "Any Town, United States" }
}
},
MessageBody = "John Doe customer information.",
QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue"
};
var response = client.SendMessage(request);
Console.WriteLine("For message ID '" + response.MessageId + "':");
Console.WriteLine(" MD5 of message attributes: " +
response.MD5OfMessageAttributes);
Console.WriteLine(" MD5 of message body: " + response.MD5OfMessageBody);
#endregion
Console.ReadLine();
}
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:37,代码来源:SQSSamples.cs
注:本文中的Amazon.SQS.Model.SendMessageRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论