示例#1
0
 private async Task AssignTaskToPeasant() {
     var sendMsgRequest = new SendMessageRequest();
     sendMsgRequest.QueueUrl = queueURL;
     var msgData = RetrievePeasantTask();
     sendMsgRequest.MessageBody = JsonConvert.SerializeObject(msgData);
     await sqsClient.SendMessageAsync(sendMsgRequest);
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SQS.Model.SendMessageRequest();

            if (cmdletContext.DelayInSeconds != null)
            {
                request.DelaySeconds = cmdletContext.DelayInSeconds.Value;
            }
            if (cmdletContext.MessageAttribute != null)
            {
                request.MessageAttributes = cmdletContext.MessageAttribute;
            }
            if (cmdletContext.MessageBody != null)
            {
                request.MessageBody = cmdletContext.MessageBody;
            }
            if (cmdletContext.MessageDeduplicationId != null)
            {
                request.MessageDeduplicationId = cmdletContext.MessageDeduplicationId;
            }
            if (cmdletContext.MessageGroupId != null)
            {
                request.MessageGroupId = cmdletContext.MessageGroupId;
            }
            if (cmdletContext.MessageSystemAttribute != null)
            {
                request.MessageSystemAttributes = cmdletContext.MessageSystemAttribute;
            }
            if (cmdletContext.QueueUrl != null)
            {
                request.QueueUrl = cmdletContext.QueueUrl;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
 public void RequestToBody()
 {
     var entity = new GetChangedEmployeesRequest() { LastChangeDate = fixedDate, ResponseQueueUrl = fixedQueueName };
     var message = new SendMessageRequest();
     message.RequestToBody(entity);
     Assert.AreEqual(fixedBody, message.MessageBody);
 }
        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();
        }
 /// <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!");
 }
        public bool Send(SendMessageRequest request)
        {
            if (request == null)
                return false;

            var response = SqsClient.SendMessage(request);
            return response != null;
        }
 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);
 }
 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);
 }
 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();
 }
示例#10
0
        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;
        }
示例#11
0
        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);
        }
示例#12
0
        /// <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);
                });
        }
示例#13
0
        public void Enqueue(string data)
        {
            if (_queueUrl == null) {
                Create_queue();
            }

            var sendMessageRequest = new SendMessageRequest {
                QueueUrl = _queueUrl,
                MessageBody = data
            };
            _sqs.SendMessage(sendMessageRequest);
        }
示例#14
0
        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);
        }
示例#15
0
        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();
            }
        }
示例#16
0
        //Send
        public async Task SendOne <T>(Message <T> message)
        {
            var request = new AwsModel.SendMessageRequest(Url, JsonConvert.SerializeObject(message.Body));

            var response = await Client.AwsClient.SendMessageAsync(request);

            if (HttpStatusCode.OK.Equals(response.HttpStatusCode))
            {
                SuccessEvent?.Invoke(true, $"Message Sent Success => Message id : {response.MessageId} - Message MD5 Body: {response.MD5OfMessageBody}");
            }
            else
            {
                ErrorEvent?.Invoke(false, $"Message Sent Error => Message id : {response.MessageId} - Response Status Code: {response.HttpStatusCode}");
            }
        }
示例#17
0
        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");
            });
           
        }
示例#18
0
        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);
        }
示例#19
0
      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);
         }
      }
        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;
        }
示例#21
0
        public async Task <IActionResult> UploadAndAuthenticate()
        {
            byte[] bytes = new byte[Request.Form.Files[0].Length];
            using (var reader = Request.Form.Files[0].OpenReadStream())
            {
                await reader.ReadAsync(bytes, 0, (int)Request.Form.Files[0].Length);
            }

            if (await AuthenticateUserByFace(bytes))
            {
                AmazonSQSClient sqsClient = new AmazonSQSClient("AKIAX2ZTBCX4OX6XH77Q", "X/FcCoEFyuIl5+hmwE+IVMk4t1089mgf0jIQI7Xo", RegionEndpoint.USEast2);
                Amazon.SQS.Model.SendMessageRequest request = new Amazon.SQS.Model.SendMessageRequest();
                request.QueueUrl    = "https://sqs.us-east-2.amazonaws.com/538588550648/ProcessCreditCardRequest";
                request.MessageBody = "User 12345 Authenticated successfully";

                SendMessageResponse response = await sqsClient.SendMessageAsync(request);
            }

            return(RedirectToAction("Success"));
        }
	    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);
	    }
示例#23
0
    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();
    }
        public async Task <SendMessageResponse> SendMessageAsync(string queueUrl,
                                                                 string messageBody,
                                                                 int delaySeconds = 0,
                                                                 Dictionary <string, MessageAttributeValue> messageAttributes = null,
                                                                 CancellationToken cancellationToken = default)
        {
            this.Logger.LogDebug($"[{nameof(this.SendMessageAsync)}]");

            this.Logger.LogTrace(JsonConvert.SerializeObject(new { queueUrl, messageBody, delaySeconds, messageAttributes }));

            if (string.IsNullOrWhiteSpace(queueUrl))
            {
                throw new ArgumentNullException(nameof(queueUrl));
            }
            if (string.IsNullOrWhiteSpace(messageBody))
            {
                throw new ArgumentNullException(nameof(messageBody));
            }

            var request = new Amazon.SQS.Model.SendMessageRequest
            {
                DelaySeconds      = delaySeconds,
                MessageAttributes = messageAttributes,
                MessageBody       = messageBody,
                QueueUrl          = queueUrl,
            };

            this.Logger.LogTrace(JsonConvert.SerializeObject(value: request));

            var response = await this.Repository.SendMessageAsync(request : request,
                                                                  cancellationToken : cancellationToken == default?this.CancellationToken.Token : cancellationToken);

            this.Logger.LogTrace(JsonConvert.SerializeObject(value: response));

            return(response);
        }
        // POST /api/echo
        public void Post(string message)
        {
            // AWS: Get instance public address
            string myAddress = HttpContext.Current.Request.Url.Authority;
            try
            {
                myAddress = Encoding.ASCII.GetString(new WebClient().DownloadData("http://169.254.169.254/latest/meta-data/public-hostname"));
            }
            catch
            {
            }

            var messageJob = new JsonObject();
            messageJob["message"] = message;
            messageJob["sender"] = myAddress;

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

            SendMessageRequest request = new SendMessageRequest()
                .WithQueueUrl("https://queue.amazonaws.com/******/codeCampDemo")
                .WithMessageBody(messageJob.ToString());
            sqsClient.SendMessage(request);
        }
示例#26
0
        /// <summary>
        /// <para>The <c>SendMessage</c> action delivers a message to the specified queue.</para>
        /// </summary>
        /// 
        /// <param name="sendMessageRequest">Container for the necessary parameters to execute the SendMessage service method on AmazonSQS.</param>
        /// 
        /// <returns>The response from the SendMessage service method, as returned by AmazonSQS.</returns>
        /// 
        /// <exception cref="T:Amazon.SQS.Model.InvalidMessageContentsException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<SendMessageResponse> SendMessageAsync(SendMessageRequest sendMessageRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SendMessageRequest, SendMessageResponse>(sendMessageRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
示例#27
0
		internal SendMessageResponse SendMessage(SendMessageRequest request)
        {
            var task = SendMessageAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
示例#28
0
        /// <summary>
        /// <para> Delivers a message to the specified queue. With Amazon SQS, you now have the ability to send large payload messages that are up to
        /// 256KB (262,144 bytes) in size. To send large payloads, you must use an AWS SDK that supports SigV4 signing. To verify whether SigV4 is
        /// supported for an AWS SDK, check the SDK release notes. </para> <para><b>IMPORTANT:</b> The following list shows the characters (in Unicode)
        /// allowed in your message, according to the W3C XML specification. For more information, go to http://www.w3.org/TR/REC-xml/#charsets If you
        /// send any characters not included in the list, your request will be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] |
        /// [#x10000 to #x10FFFF] </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage service method on AmazonSQS.</param>
        /// 
        /// <returns>The response from the SendMessage service method, as returned by AmazonSQS.</returns>
        /// 
        /// <exception cref="T:Amazon.SQS.Model.InvalidMessageContentsException" />
		public SendMessageResponse SendMessage(SendMessageRequest request)
        {
            var task = SendMessageAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
示例#29
0
        /// <summary>
        /// Requeues the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="delayMilliseconds">Number of milliseconds to delay delivery of the message.</param>
        public void Requeue(Message message, int delayMilliseconds)
        {
            try
            {
                Reject(message, false);

                using (var client = new AmazonSQSClient(_credentials))
                {
                    _logger.Value.InfoFormat("SqsMessageConsumer: requeueing the message {0}", message.Id);

                    message.Header.Bag.Remove("ReceiptHandle");
                    var request = new SendMessageRequest(_queueUrl, JsonConvert.SerializeObject(message))
                                  {
                                      DelaySeconds = (int)TimeSpan.FromMilliseconds(delayMilliseconds).TotalSeconds
                                  };

                    client.SendMessageAsync(request).Wait();
                }

                _logger.Value.InfoFormat("SqsMessageConsumer: requeued the message {0}", message.Id);
            }
            catch (Exception exception)
            {
                _logger.Value.ErrorException("SqsMessageConsumer: Error purging queue {0}", exception, _queueUrl);
                throw;
            }
        }
        public virtual void PostToQueue(AmazonSQSClient sqsClient, string queueUrl, string messageText)
        {
            // Create the request
            var sendMessageRequest = new SendMessageRequest
            {
                MessageBody = messageText,
                QueueUrl = queueUrl
            };

            //Send message to queue
            sqsClient.SendMessage(sendMessageRequest);
        }
 private Amazon.SQS.Model.SendMessageResponse CallAWSServiceOperation(IAmazonSQS client, Amazon.SQS.Model.SendMessageRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Queue Service (SQS)", "SendMessage");
     try
     {
         #if DESKTOP
         return(client.SendMessage(request));
         #elif CORECLR
         return(client.SendMessageAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
示例#32
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS.SendMessage"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<SendMessageResponse> SendMessageAsync(SendMessageRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, SendMessageRequest, SendMessageResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
示例#33
0
        /// <summary>
        /// Initiates the asynchronous execution of the SendMessage operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendMessage operation on AmazonSQSClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSendMessage
        ///         operation.</returns>
        public IAsyncResult BeginSendMessage(SendMessageRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return BeginInvoke<SendMessageRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
示例#34
0
        /// <summary>
        /// Delivers a message to the specified      queue. With Amazon SQS, you now have
        /// the ability to send large payload messages that are up      to 256KB (262,144 bytes)
        /// in size. To send large payloads, you must use an AWS SDK that      supports SigV4
        /// signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK      release
        /// notes.    
        /// 
        ///     <important>      
        /// <para>
        ///         The following list shows the characters (in Unicode) allowed in your message,
        /// according        to the W3C XML specification. For more information, go to       
        ///         <a href="http://www.w3.org/TR/REC-xml/#charsets">http://www.w3.org/TR/REC-xml/#charsets</a>
        ///                If you send any characters not included in the list, your request will
        /// be rejected.      
        /// </para>
        ///       
        /// <para>
        ///         #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]
        ///      
        /// </para>
        ///     </important>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SendMessage service method.</param>
        /// 
        /// <returns>The response from the SendMessage service method, as returned by SQS.</returns>
        /// <exception cref="InvalidMessageContentsException">
        /// The message contains characters outside the allowed set.
        /// </exception>
        /// <exception cref="UnsupportedOperationException">
        /// Error code 400. Unsupported operation.
        /// </exception>
        public SendMessageResponse SendMessage(SendMessageRequest request)
        {
            var marshaller = new SendMessageRequestMarshaller();
            var unmarshaller = SendMessageResponseUnmarshaller.Instance;

            return Invoke<SendMessageRequest,SendMessageResponse>(request, marshaller, unmarshaller);
        }
示例#35
0
 /// <summary>
 /// Delivers a message to the specified      queue. With Amazon SQS, you now have
 /// the ability to send large payload messages that are up      to 256KB (262,144 bytes)
 /// in size. To send large payloads, you must use an AWS SDK that      supports SigV4
 /// signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK      release
 /// notes.    
 /// 
 ///     <important>      
 /// <para>
 ///         The following list shows the characters (in Unicode) allowed in your message,
 /// according        to the W3C XML specification. For more information, go to       
 ///         <a href="http://www.w3.org/TR/REC-xml/#charsets">http://www.w3.org/TR/REC-xml/#charsets</a>
 ///                If you send any characters not included in the list, your request will
 /// be rejected.      
 /// </para>
 ///       
 /// <para>
 ///         #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]
 ///      
 /// </para>
 ///     </important>
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue to take action on.</param>
 /// <param name="messageBody">The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.</param>
 /// 
 /// <returns>The response from the SendMessage service method, as returned by SQS.</returns>
 /// <exception cref="InvalidMessageContentsException">
 /// The message contains characters outside the allowed set.
 /// </exception>
 /// <exception cref="UnsupportedOperationException">
 /// Error code 400. Unsupported operation.
 /// </exception>
 public SendMessageResponse SendMessage(string queueUrl, string messageBody)
 {
     var request = new SendMessageRequest();
     request.QueueUrl = queueUrl;
     request.MessageBody = messageBody;
     return SendMessage(request);
 }