public static string GetSqsQueueName(string destination, TransportConfiguration transportConfiguration)
        {
            if (string.IsNullOrWhiteSpace(destination))
            {
                throw new ArgumentNullException(nameof(destination));
            }

            // we need to process again because of the way we handle fifo queues
            var queueName = !string.IsNullOrEmpty(transportConfiguration.QueueNamePrefix) &&
                            destination.StartsWith(transportConfiguration.QueueNamePrefix, StringComparison.Ordinal) ?
                            destination :
                            $"{transportConfiguration.QueueNamePrefix}{destination}";

            if (transportConfiguration.PreTruncateQueueNames && queueName.Length > 80)
            {
                var charsToTake = 80 - transportConfiguration.QueueNamePrefix.Length;
                queueName = transportConfiguration.QueueNamePrefix +
                            new string(queueName.Reverse().Take(charsToTake).Reverse().ToArray());
            }

            if (queueName.Length > 80)
            {
                throw new Exception($"Address {destination} with configured prefix {transportConfiguration.QueueNamePrefix} is longer than 80 characters and therefore cannot be used to create an SQS queue. Use a shorter queue name.");
            }

            return(GetSanitizedQueueName(queueName));
        }
Exemple #2
0
 public DelayedMessagesPump(TransportConfiguration configuration, IAmazonSQS sqsClient, QueueCache queueCache)
 {
     this.queueCache    = queueCache;
     this.sqsClient     = sqsClient;
     this.configuration = configuration;
     awsEndpointUrl     = sqsClient.Config.DetermineServiceURL();
 }
 public QueueCreator(TransportConfiguration configuration, IAmazonS3 s3Client, IAmazonSQS sqsClient, QueueCache queueCache)
 {
     this.configuration = configuration;
     this.s3Client      = s3Client;
     this.sqsClient     = sqsClient;
     this.queueCache    = queueCache;
 }
 public QueueCache(IAmazonSQS sqsClient, TransportConfiguration configuration)
 {
     this.configuration              = configuration;
     queueNameToUrlCache             = new ConcurrentDictionary <string, string>();
     queueNameToPhysicalAddressCache = new ConcurrentDictionary <string, string>();
     queueUrlToQueueArnCache         = new ConcurrentDictionary <string, string>();
     this.sqsClient = sqsClient;
 }
 public InputQueuePump(TransportConfiguration configuration, IAmazonS3 s3Client, IAmazonSQS sqsClient, QueueCache queueCache)
 {
     this.configuration = configuration;
     this.s3Client      = s3Client;
     this.sqsClient     = sqsClient;
     this.queueCache    = queueCache;
     awsEndpointUrl     = sqsClient.Config.DetermineServiceURL();
 }
 public MessageDispatcher(TransportConfiguration configuration, IAmazonS3 s3Client, IAmazonSQS sqsClient, IAmazonSimpleNotificationService snsClient, QueueCache queueCache, TopicCache topicCache)
 {
     this.topicCache    = topicCache;
     this.snsClient     = snsClient;
     this.configuration = configuration;
     this.s3Client      = s3Client;
     this.sqsClient     = sqsClient;
     this.queueCache    = queueCache;
     serializerStrategy = configuration.UseV1CompatiblePayload ? SimpleJson.PocoJsonSerializerStrategy : ReducedPayloadSerializerStrategy.Instance;
 }
 public MessagePump(TransportConfiguration configuration, InputQueuePump inputQueuePump, DelayedMessagesPump delayedMessagesPump)
 {
     this.configuration       = configuration;
     this.inputQueuePump      = inputQueuePump;
     this.delayedMessagesPump = delayedMessagesPump;
 }
 public TopicCache(IAmazonSimpleNotificationService snsClient, MessageMetadataRegistry messageMetadataRegistry, TransportConfiguration configuration)
 {
     this.configuration           = configuration;
     this.messageMetadataRegistry = messageMetadataRegistry;
     this.snsClient = snsClient;
     CustomEventToTopicsMappings = configuration.CustomEventToTopicsMappings ?? new EventToTopicsMappings();
     CustomEventToEventsMappings = configuration.CustomEventToEventsMappings ?? new EventToEventsMappings();
 }