コード例 #1
0
    /// <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);
    }
コード例 #2
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 WithQueueUri <T>(Uri queueUrl)
        where T : Message
    {
        if (queueUrl == null)
        {
            throw new ArgumentNullException(nameof(queueUrl));
        }

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

        Publications.Add(builder);

        return(this);
    }