public void ValidArnCanBeParsed() { var qa = QueueAddress.FromArn("arn:aws:sqs:eu-west-1:111122223333:queue1"); Assert.Equal("https://sqs.eu-west-1.amazonaws.com/111122223333/queue1", qa.QueueUrl.AbsoluteUri); Assert.Equal("eu-west-1", qa.RegionName); }
/// <summary> /// Configures a publisher for a pre-existing topic. /// </summary> /// <param name="queueArn">The ARN of the queue to publish to.</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 WithQueueArn <T>(string queueArn) where T : Message { if (queueArn == null) { throw new ArgumentNullException(nameof(queueArn)); } var builder = new QueueAddressPublicationBuilder <T>(QueueAddress.FromArn(queueArn)); Publications.Add(builder); return(this); }
/// <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); }
public void ParsingEmptyArnThrows() { Assert.Throws <ArgumentException>("queueArn", () => QueueAddress.FromArn("")); }
public void ArnForWrongServiceThrows() { Assert.Throws <ArgumentException>("queueArn", () => QueueAddress.FromArn("arn:aws:sns:eu-west-1:111122223333:queue1")); }
public void ParsingNullArnThrows() { Assert.Throws <ArgumentException>("queueArn", () => QueueAddress.FromArn(null)); }