예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountAddressProvider"/> class with provided naming conventions.
 /// </summary>
 /// <param name="accountId">The AWS account ID the topics and queues belong in.</param>
 /// <param name="regionEndpoint">The AWS region the topics and queues belong in.</param>
 /// <param name="queueNamingConvention">A <see cref="IQueueNamingConvention"/> to use for producing a queue name from a message type.</param>
 /// <param name="topicNamingConvention">A <see cref="ITopicNamingConvention"/> to use for producing a topic name from a message type</param>
 public AccountAddressProvider(string accountId, RegionEndpoint regionEndpoint, IQueueNamingConvention queueNamingConvention, ITopicNamingConvention topicNamingConvention)
 {
     _accountId             = accountId;
     _regionEndpoint        = regionEndpoint;
     _queueNamingConvention = queueNamingConvention;
     _topicNamingConvention = topicNamingConvention;
 }
예제 #2
0
 public EventConsumer(IServiceProvider serviceProvider, ITopicNamingConvention topicNamingConvention,
                      ILogger <EventConsumer <TEvent> > logger)
 {
     _serviceProvider       = serviceProvider;
     _topicNamingConvention = topicNamingConvention;
     _logger = logger;
 }
 public static JustSayingFluentlyDependencies UsingTopicNameConvention(
     this JustSayingFluentlyDependencies dependencies,
     ITopicNamingConvention topicNamingConvention)
 {
     dependencies.TopicNamingConvention = topicNamingConvention;
     return(dependencies);
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AccountAddressProvider"/> class with the default naming convention.
        /// </summary>
        /// <param name="accountId">The AWS account ID the topics and queues belong in.</param>
        /// <param name="regionEndpoint">The AWS region the topics and queues belong in.</param>
        public AccountAddressProvider(string accountId, RegionEndpoint regionEndpoint)
        {
            _accountId      = accountId;
            _regionEndpoint = regionEndpoint;
            var namingConventions = new DefaultNamingConventions();

            _queueNamingConvention = namingConventions;
            _topicNamingConvention = namingConventions;
        }
예제 #5
0
 public NumberController(
     IDistributedLog distributedLog,
     IStreamConsumer consumer,
     ITopicNamingConvention namingConvention, ILogger <NumberController> logger)
 {
     _distributedLog   = distributedLog;
     _consumer         = consumer;
     _namingConvention = namingConvention;
     _logger           = logger;
 }
        /// <summary>
        /// Applies an <see cref="ITopicNamingConvention"/> to a type <see cref="T"/> and returns the result, with an optional override.
        /// </summary>
        /// <param name="namingConvention">An <see cref="ITopicNamingConvention"/> to apply to the T</param>
        /// <param name="overrideTopicName">An override that will be returned instead of the naming convention
        /// if the override is not null or whitespace.</param>
        /// <typeparam name="T">A type from which a topic name will be determined using the supplied <see cref="ITopicNamingConvention"/>.</typeparam>
        /// <returns>A string that is either the override if supplied, or the <see cref="ITopicNamingConvention"/> applied to the <see cref="T"/></returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="namingConvention"/> is <see langword="null"/>.
        /// </exception>
        public static string Apply <T>(this ITopicNamingConvention namingConvention, string overrideTopicName)
        {
            if (namingConvention == null)
            {
                throw new ArgumentNullException(nameof(namingConvention));
            }

            return(string.IsNullOrWhiteSpace(overrideTopicName)
                ? namingConvention.TopicName <T>()
                : overrideTopicName);
        }
예제 #7
0
 public EventProjector(
     IStreamConsumer streamConsumer,
     ITopicNamingConvention topicNamingConvention,
     IEnumerable <IEventApplier <TEvent> > eventAppliers,
     ILogger <EventProjector <TEvent> > logger)
 {
     _streamConsumer        = streamConsumer;
     _topicNamingConvention = topicNamingConvention;
     _eventAppliers         = eventAppliers;
     _logger = logger;
 }
예제 #8
0
        public NamespaceManager(IOptions <OpenMessageAzureProviderOptions <T> > options,
                                IQueueNamingConvention queueNamingConvention,
                                ITopicNamingConvention topicNamingConvention,
                                ISubscriptionNamingConvention subscriptionNamingConvention,
                                ILogger <NamespaceManager <T> > logger)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (queueNamingConvention == null)
            {
                throw new ArgumentNullException(nameof(queueNamingConvention));
            }

            if (topicNamingConvention == null)
            {
                throw new ArgumentNullException(nameof(topicNamingConvention));
            }

            if (subscriptionNamingConvention == null)
            {
                throw new ArgumentNullException(nameof(subscriptionNamingConvention));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (string.IsNullOrWhiteSpace(options.Value?.ConnectionString))
            {
                throw new ArgumentException($"The connection string has not been set for the type: {typeof(T).GetFriendlyName()}");
            }

            _options = options.Value;
            _logger  = logger;
            _queueNamingConvention        = queueNamingConvention;
            _topicNamingConvention        = topicNamingConvention;
            _subscriptionNamingConvention = subscriptionNamingConvention;
        }
예제 #9
0
 public void ApplyTopicNamingConvention <T>(ITopicNamingConvention namingConvention)
 {
     TopicName = namingConvention.Apply <T>(TopicName);
 }
예제 #10
0
 /// <summary>
 /// Specifies the <see cref="ITopicNamingConvention"/> to use.
 /// </summary>
 /// <param name="namingConvention">The <see cref="ITopicNamingConvention"/> to use.</param>
 /// <returns>
 /// The current <see cref="MessagingConfigurationBuilder"/>.
 /// </returns>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="namingConvention"/> is <see cref="null"/>.
 /// </exception>
 public MessagingConfigurationBuilder WithTopicNamingConvention(ITopicNamingConvention namingConvention)
 {
     TopicNamingConvention = namingConvention ?? throw new ArgumentNullException(nameof(namingConvention));
     return(this);
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountAddressProvider"/> class with provided naming conventions.
 /// </summary>
 /// <param name="accountId">The AWS account ID the topics and queues belong in.</param>
 /// <param name="regionName">The AWS region the topics and queues belong in.</param>
 /// <param name="queueNamingConvention">A <see cref="IQueueNamingConvention"/> to use for producing a queue name from a message type.</param>
 /// <param name="topicNamingConvention">A <see cref="ITopicNamingConvention"/> to use for producing a topic name from a message type</param>
 public AccountAddressProvider(string accountId, string regionName, IQueueNamingConvention queueNamingConvention, ITopicNamingConvention topicNamingConvention)
     : this(accountId, RegionEndpoint.GetBySystemName(regionName), queueNamingConvention, topicNamingConvention)
 {
 }