Example #1
0
        /// <summary>
        /// We may want to have a builder/endpoint context that could store things like management endpoint, etc. to configure
        /// filters and add configuration interfaces for things like concurrency limit and prefetch count
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="definition"></param>
        /// <param name="configure">The callback to invoke after the definition configuration has been applied</param>
        internal static void Apply(this IInMemoryReceiveEndpointConfigurator configurator, IEndpointDefinition definition,
                                   Action <IInMemoryReceiveEndpointConfigurator> configure = null)
        {
            if (definition.ConcurrentMessageLimit.HasValue)
            {
                configurator.ConcurrencyLimit = definition.ConcurrentMessageLimit.Value;
            }

            definition.Configure(configurator);

            configure?.Invoke(configurator);
        }
Example #2
0
        public override void ReceiveEndpoint(IEndpointDefinition definition, IEndpointNameFormatter endpointNameFormatter,
                                             Action <IReceiveEndpointConfigurator> configureEndpoint = null)
        {
            var queueName = definition.GetEndpointName(endpointNameFormatter ?? DefaultEndpointNameFormatter.Instance);

            var configuration = _configuration.CreateReceiveEndpointConfiguration(queueName, _configuration.CreateEndpointConfiguration());

            void Configure(IHttpReceiveEndpointConfigurator configurator)
            {
                definition.Configure(configurator);

                configureEndpoint?.Invoke(configurator);
            }

            ConfigureReceiveEndpoint(configuration, configuration.Configurator, Configure);
        }
Example #3
0
        /// <summary>
        /// We may want to have a builder/endpoint context that could store things like management endpoint, etc. to configure
        /// filters and add configuration interfaces for things like concurrency limit and prefetch count
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="definition"></param>
        /// <param name="configure">The callback to invoke after the definition configuration has been applied</param>
        internal static void Apply(this IActiveMqReceiveEndpointConfigurator configurator, IEndpointDefinition definition,
                                   Action <IActiveMqReceiveEndpointConfigurator> configure = null)
        {
            if (definition.IsTemporary)
            {
                configurator.AutoDelete = true;
                configurator.Durable    = false;
            }

            if (definition.ConcurrentMessageLimit.HasValue)
            {
                configurator.UseConcurrencyLimit(definition.ConcurrentMessageLimit.Value);
            }

            definition.Configure(configurator);

            configure?.Invoke(configurator);
        }
Example #4
0
        public void ReceiveEndpoint(IHttpHost host, IEndpointDefinition definition, IEndpointNameFormatter endpointNameFormatter,
                                    Action <IHttpReceiveEndpointConfigurator> configureEndpoint = null)
        {
            var queueName = definition.GetEndpointName(endpointNameFormatter ?? DefaultEndpointNameFormatter.Instance);

            if (!_configuration.Hosts.TryGetHost(host, out var hostConfiguration))
            {
                throw new ArgumentException("The host was not configured on this bus", nameof(host));
            }

            var configuration = hostConfiguration.CreateReceiveEndpointConfiguration(queueName);

            void Configure(IHttpReceiveEndpointConfigurator configurator)
            {
                definition.Configure(configurator);

                configureEndpoint?.Invoke(configurator);
            }

            ConfigureReceiveEndpoint(configuration, configuration.Configurator, Configure);
        }
        /// <summary>
        /// We may want to have a builder/endpoint context that could store things like management endpoint, etc. to configure
        /// filters and add configuration interfaces for things like concurrency limit and prefetch count
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="definition"></param>
        /// <param name="configure">The callback to invoke after the definition configuration has been applied</param>
        internal static void Apply(this IServiceBusReceiveEndpointConfigurator configurator, IEndpointDefinition definition,
                                   Action <IServiceBusReceiveEndpointConfigurator> configure = null)
        {
            if (definition.IsTemporary)
            {
                configurator.AutoDeleteOnIdle    = Defaults.TemporaryAutoDeleteOnIdle;
                configurator.RemoveSubscriptions = true;
            }

            if (definition.PrefetchCount.HasValue)
            {
                configurator.PrefetchCount = (ushort)definition.PrefetchCount.Value;
            }

            if (definition.ConcurrentMessageLimit.HasValue)
            {
                var concurrentMessageLimit = definition.ConcurrentMessageLimit.Value;

                // if there is a prefetchCount, and it's greater than the concurrent message limit, we need a filter
                if (!definition.PrefetchCount.HasValue || definition.PrefetchCount.Value > concurrentMessageLimit)
                {
                    configurator.MaxConcurrentCalls = concurrentMessageLimit;

                    // we should determine a good value to use based upon the concurrent message limit
                    if (definition.PrefetchCount.HasValue == false)
                    {
                        var calculatedPrefetchCount = concurrentMessageLimit * 12 / 10;

                        configurator.PrefetchCount = (ushort)calculatedPrefetchCount;
                    }
                }
            }

            definition.Configure(configurator);

            configure?.Invoke(configurator);
        }
Example #6
0
        /// <summary>
        /// We may want to have a builder/endpoint context that could store things like management endpoint, etc. to configure
        /// filters and add configuration interfaces for things like concurrency limit and prefetch count
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="definition"></param>
        /// <param name="configure">The callback to invoke after the definition configuration has been applied</param>
        internal static void Apply(this IAmazonSqsReceiveEndpointConfigurator configurator, IEndpointDefinition definition,
                                   Action <IAmazonSqsReceiveEndpointConfigurator> configure = null)
        {
            if (definition.IsTemporary)
            {
                configurator.AutoDelete = true;
                configurator.Durable    = false;
            }

            if (definition.PrefetchCount.HasValue)
            {
                configurator.PrefetchCount = (ushort)definition.PrefetchCount.Value;
            }

            if (definition.ConcurrentMessageLimit.HasValue)
            {
                var concurrentMessageLimit = definition.ConcurrentMessageLimit.Value;

                // if there is a prefetchCount, and it's greater than the concurrent message limit, we need a filter
                if (!definition.PrefetchCount.HasValue || definition.PrefetchCount.Value > concurrentMessageLimit)
                {
                    configurator.UseConcurrencyLimit(concurrentMessageLimit);

                    // we should determine a good value to use based upon the concurrent message limit
                    if (definition.PrefetchCount.HasValue == false)
                    {
                        var calculatedPrefetchCount = concurrentMessageLimit * 12 / 10;

                        configurator.PrefetchCount = (ushort)calculatedPrefetchCount;
                    }
                }
            }

            definition.Configure(configurator);

            configure?.Invoke(configurator);
        }
 public void Configure <T>(T configurator)
     where T : IReceiveEndpointConfigurator
 {
     _endpointDefinition?.Configure(configurator);
 }
Example #8
0
 void IEndpointDefinition.Configure <T>(T configurator)
 {
     _definition.Configure(configurator);
 }