public TransportMessage SendRawAndReceiveMessage(string rawMessageString)
 {
     return(SendAndReceiveCore(() =>
     {
         SqsClient.SendMessage(QueueUrlCache.GetQueueUrl(Address), rawMessageString);
     }));
 }
Exemplo n.º 2
0
        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);
        }
        public void CreateQueue()
        {
            Creator.CreateQueueIfNecessary(Address, "");

            try
            {
                SqsClient.PurgeQueue(QueueUrlCache.GetQueueUrl(Address));
            }
            catch (PurgeQueueInProgressException)
            {
            }
        }