Beispiel #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);
    }
Beispiel #2
0
 public void ParsingEmptyArnThrows()
 {
     Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn(""));
 }
Beispiel #3
0
 public void ArnForWrongServiceThrows()
 {
     Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn("arn:aws:sqs:eu-west-1:111122223333:queue1"));
 }
Beispiel #4
0
        public void ValidArnCanBeParsed()
        {
            var ta = TopicAddress.FromArn("arn:aws:sns:eu-west-1:111122223333:topic1");

            Assert.Equal("arn:aws:sns:eu-west-1:111122223333:topic1", ta.TopicArn);
        }
Beispiel #5
0
 public void ParsingNullArnThrows()
 {
     Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn(null));
 }