コード例 #1
0
        async Task <QueueInfo> CreateMissingQueue(Queue queue)
        {
            Dictionary <string, string> attributes = queue.QueueAttributes.ToDictionary(x => x.Key, x => x.Value.ToString());

            if (AmazonSqsEndpointAddress.IsFifo(queue.EntityName) && !attributes.ContainsKey(QueueAttributeName.FifoQueue))
            {
                LogContext.Warning?.Log("Using '.fifo' suffix without 'FifoQueue' attribute might cause unexpected behavior.");

                attributes[QueueAttributeName.FifoQueue] = "true";
            }

            var request = new CreateQueueRequest(queue.EntityName)
            {
                Attributes = attributes,
                Tags       = queue.QueueTags.ToDictionary(x => x.Key, x => x.Value)
            };

            var createResponse = await _client.CreateQueueAsync(request, _cancellationToken).ConfigureAwait(false);

            createResponse.EnsureSuccessfulResponse();

            var attributesResponse = await _client.GetQueueAttributesAsync(createResponse.QueueUrl, AllAttributes, _cancellationToken).ConfigureAwait(false);

            attributesResponse.EnsureSuccessfulResponse();

            var missingQueue = new QueueInfo(queue.EntityName, createResponse.QueueUrl, attributesResponse.Attributes, _client, _cancellationToken);

            if (queue.Durable && queue.AutoDelete == false)
            {
                lock (_durableQueues)
                    _durableQueues[missingQueue.EntityName] = missingQueue;
            }

            return(missingQueue);
        }
コード例 #2
0
        protected SqsMoveTransport(string destination, IFilter <ClientContext> topologyFilter)
        {
            _destination    = destination;
            _topologyFilter = topologyFilter;

            _isFifo = AmazonSqsEndpointAddress.IsFifo(destination);
        }
コード例 #3
0
        protected QueueConfigurator(string queueName, bool durable = true, bool autoDelete = false, IDictionary <string, object> queueAttributes = null,
                                    IDictionary <string, object> queueSubscriptionAttributes = null, IDictionary <string, string> queueTags = null)
            : base(queueName, durable, autoDelete)
        {
            QueueAttributes             = queueAttributes ?? new Dictionary <string, object>();
            QueueSubscriptionAttributes = queueSubscriptionAttributes ?? new Dictionary <string, object>();
            QueueTags = queueTags ?? new Dictionary <string, string>();

            if (AmazonSqsEndpointAddress.IsFifo(queueName))
            {
                QueueAttributes[QueueAttributeName.FifoQueue] = "true";
            }
        }
コード例 #4
0
        public QueueReceiveSettings(IAmazonSqsEndpointConfiguration configuration, string queueName, bool durable, bool autoDelete)
            : base(queueName, durable, autoDelete)
        {
            _configuration = configuration;

            WaitTimeSeconds   = 3;
            VisibilityTimeout = 30;

            if (AmazonSqsEndpointAddress.IsFifo(queueName))
            {
                IsOrdered = true;
            }
        }
コード例 #5
0
        public TopicConfigurator(string topicName, bool durable = true, bool autoDelete = false, IDictionary <string, object> topicAttributes = null,
                                 IDictionary <string, object> topicSubscriptionAttributes = null, IDictionary <string, string> topicTags = null)
            : base(topicName, durable, autoDelete)
        {
            TopicAttributes             = topicAttributes ?? new Dictionary <string, object>();
            TopicSubscriptionAttributes = topicSubscriptionAttributes ?? new Dictionary <string, object>();
            TopicTags = topicTags ?? new Dictionary <string, string>();

            if (AmazonSqsEndpointAddress.IsFifo(topicName))
            {
                TopicAttributes["FifoTopic"] = "true";
            }
        }