public QueueAddressQueue(QueueAddress queueAddress, IAmazonSQS sqsClient)
        {
            _client = sqsClient;

            Uri = queueAddress.QueueUrl;
            var pathSegments = queueAddress.QueueUrl.Segments.Select(x => x.Trim('/')).Where(x => !string.IsNullOrEmpty(x)).ToArray();

            if (pathSegments.Length != 2)
            {
                throw new ArgumentException("Queue Url was not correctly formatted. Path should contain 2 segments.");
            }

            var region    = RegionEndpoint.GetBySystemName(queueAddress.RegionName);
            var accountId = pathSegments[0];
            var resource  = pathSegments[1];

            RegionSystemName = region.SystemName;
            QueueName        = resource;
            Arn = new Arn {
                Partition = region.PartitionName, Service = "sqs", Region = region.SystemName, AccountId = accountId, Resource = resource
            }.ToString();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueAddressSubscriptionBuilder{T}"/> class.
 /// </summary>
 /// <param name="queueAddress">The address of the queue to subscribe to.</param>
 internal QueueAddressSubscriptionBuilder(QueueAddress queueAddress)
 {
     _queueAddress = queueAddress;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueAddressPublicationBuilder{T}"/> class.
 /// </summary>
 /// <param name="queueAddress">The address of the queue to publish to.</param>
 internal QueueAddressPublicationBuilder(QueueAddress queueAddress)
 {
     _queueAddress = queueAddress;
 }