Esempio n. 1
0
        public void LocalStackUrlWithRegionCanBeParsed()
        {
            var qa = QueueAddress.FromUrl("http://localhost:4576/111122223333/queue1", "us-east-1");

            Assert.Equal("http://localhost:4576/111122223333/queue1", qa.QueueUrl.AbsoluteUri);
            Assert.Equal("us-east-1", qa.RegionName);
        }
Esempio n. 2
0
        public void ValidUrlCanBeParsed()
        {
            var qa = QueueAddress.FromUrl("https://sqs.eu-west-1.amazonaws.com/111122223333/queue1");

            Assert.Equal("https://sqs.eu-west-1.amazonaws.com/111122223333/queue1", qa.QueueUrl.AbsoluteUri);
            Assert.Equal("eu-west-1", qa.RegionName);
        }
Esempio n. 3
0
        public void UppercaseUrlCanBeParsed()
        {
            var qa = QueueAddress.FromUrl("HTTPS://SQS.EU-WEST-1.AMAZONAWS.COM/111122223333/Queue1");

            // Queue name is case-sensitive.
            Assert.Equal("https://sqs.eu-west-1.amazonaws.com/111122223333/Queue1", qa.QueueUrl.AbsoluteUri);
            Assert.Equal("eu-west-1", qa.RegionName);
        }
Esempio n. 4
0
    /// <summary>
    /// Configures a publisher for a pre-existing topic.
    /// </summary>
    /// <param name="queueUrl">The URL 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 WithQueueUrl <T>(string queueUrl)
        where T : Message
    {
        if (queueUrl == null)
        {
            throw new ArgumentNullException(nameof(queueUrl));
        }

        var builder = new QueueAddressPublicationBuilder <T>(QueueAddress.FromUrl(queueUrl));

        Publications.Add(builder);

        return(this);
    }
Esempio n. 5
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 ForQueueUrl <T>(string queueUrl, string regionName = null, Action <QueueAddressSubscriptionBuilder <T> > configure = null)
        where T : Message
    {
        if (queueUrl == null)
        {
            throw new ArgumentNullException(nameof(queueUrl));
        }

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

        configure?.Invoke(builder);

        Subscriptions.Add(builder);

        return(this);
    }
Esempio n. 6
0
 public void EmptyUrlThrows()
 {
     Assert.Throws <ArgumentException>("queueUrl", () => QueueAddress.FromUrl(""));
 }
Esempio n. 7
0
        public void LocalStackUrlWithoutRegionHashUnknownRegion()
        {
            var qa = QueueAddress.FromUrl("http://localhost:4576/111122223333/queue1");

            Assert.Equal("unknown", qa.RegionName);
        }