예제 #1
0
        /// <summary>
        /// Configures a queue subscription for a pre-existing queue.
        /// </summary>
        /// <param name="queueUrl">The URL of the queue to subscribe to.</param>
        /// <param name="regionName">The AWS region the queue is in.</param>
        /// <param name="configure">An optional delegate to configure a queue subscription.</param>
        /// <typeparam name="T">The type of the message to subscribe to.</typeparam>
        /// <returns>The current <see cref="SubscriptionsBuilder"/>.</returns>
        public SubscriptionsBuilder ForQueueUri <T>(Uri queueUrl, string regionName = null, Action <QueueAddressSubscriptionBuilder <T> > configure = null)
            where T : Message
        {
            if (queueUrl == null)
            {
                throw new ArgumentNullException(nameof(queueUrl));
            }

            var queueAddress = QueueAddress.FromUri(queueUrl, regionName);
            var builder      = new QueueAddressSubscriptionBuilder <T>(queueAddress);

            configure?.Invoke(builder);

            Subscriptions.Add(builder);

            return(this);
        }
예제 #2
0
        /// <summary>
        /// Configures a queue subscription for a pre-existing queue.
        /// </summary>
        /// <param name="queueArn">The ARN of the queue to subscribe to.</param>
        /// <param name="configure">An optional delegate to configure a queue subscription.</param>
        /// <typeparam name="T">The type of the message to subscribe to.</typeparam>
        /// <returns>The current <see cref="SubscriptionsBuilder"/>.</returns>
        public SubscriptionsBuilder ForQueueArn <T>(string queueArn, Action <QueueAddressSubscriptionBuilder <T> > configure = null)
            where T : Message
        {
            if (queueArn == null)
            {
                throw new ArgumentNullException(nameof(queueArn));
            }

            var queueAddress = QueueAddress.FromArn(queueArn);
            var builder      = new QueueAddressSubscriptionBuilder <T>(queueAddress);

            configure?.Invoke(builder);

            Subscriptions.Add(builder);

            return(this);
        }