Exemplo n.º 1
0
        /// <summary>
        /// Configures a publisher for a pre-existing topic.
        /// </summary>
        /// <param name="topicArn">The ARN of the topic to publish to.</param>
        /// <param name="configure">An optional delegate to configure a topic publisher.</param>
        /// <typeparam name="T">The type of the message to publish to.</typeparam>
        /// <returns>The current <see cref="PublicationsBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException"></exception>
        public PublicationsBuilder WithTopicArn <T>(string topicArn, Action <TopicAddressPublicationBuilder <T> > configure = null)
            where T : Message
        {
            if (topicArn == null)
            {
                throw new ArgumentNullException(nameof(topicArn));
            }

            var builder = new TopicAddressPublicationBuilder <T>(TopicAddress.FromArn(topicArn));

            configure?.Invoke(builder);

            Publications.Add(builder);

            return(this);
        }