/// <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); }
public void ParsingEmptyArnThrows() { Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn("")); }
public void ArnForWrongServiceThrows() { Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn("arn:aws:sqs:eu-west-1:111122223333:queue1")); }
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); }
public void ParsingNullArnThrows() { Assert.Throws <ArgumentException>("topicArn", () => TopicAddress.FromArn(null)); }