Esempio n. 1
0
    /// <summary>
    /// Configures a topic subscription.
    /// </summary>
    /// <typeparam name="T">The type of the message to subscribe to.</typeparam>
    /// <param name="configure">A delegate to a method to use to configure a topic subscription.</param>
    /// <returns>
    /// The current <see cref="SubscriptionsBuilder"/>.
    /// </returns>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="configure"/> is <see langword="null"/>.
    /// </exception>
    public SubscriptionsBuilder ForTopic <T>(Action <TopicSubscriptionBuilder <T> > configure)
        where T : Message
    {
        if (configure == null)
        {
            throw new ArgumentNullException(nameof(configure));
        }

        var builder = new TopicSubscriptionBuilder <T>();

        configure(builder);

        Subscriptions.Add(builder);

        return(this);
    }
Esempio n. 2
0
    /// <summary>
    /// Configures a topic subscription.
    /// </summary>
    /// <typeparam name="T">The type of the message to subscribe to.</typeparam>
    /// <param name="topicNameOverride">The name of the topic that this queue will be subscribed to. Overrides the default set by the <see cref="ITopicNamingConvention"/>.</param>
    /// <param name="configure">A delegate to a method to use to configure a topic subscription.</param>
    /// <returns>
    /// The current <see cref="SubscriptionsBuilder"/>.
    /// </returns>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="configure"/> is <see langword="null"/>.
    /// </exception>
    public SubscriptionsBuilder ForTopic <T>(string topicNameOverride, Action <TopicSubscriptionBuilder <T> > configure)
        where T : Message
    {
        if (configure == null)
        {
            throw new ArgumentNullException(nameof(configure));
        }
        if (topicNameOverride == null)
        {
            throw new ArgumentNullException(nameof(topicNameOverride));
        }

        var builder = new TopicSubscriptionBuilder <T>().WithTopicName(topicNameOverride);

        configure(builder);

        Subscriptions.Add(builder);

        return(this);
    }
Esempio n. 3
0
 public WhenUsingTopicSubscriberBuilder()
 {
     _sut = new TopicSubscriptionBuilder <Order>();
 }