Example #1
0
        //note: this should be handled in a feature but we don't have a good
        // extension point to plugin atm
        PushRuntimeSettings GeDequeueLimitationsForReceivePipeline()
        {
            var transportConfig = settings.GetConfigSection <TransportConfig>();

            int?concurrencyMaxFromConfig = null;

            if (transportConfig != null && transportConfig.MaximumConcurrencyLevel > 0)
            {
                concurrencyMaxFromConfig = transportConfig.MaximumConcurrencyLevel;
            }

            MessageProcessingOptimizationExtensions.ConcurrencyLimit concurrencyLimit;

            if (settings.TryGet(out concurrencyLimit))
            {
                if (concurrencyMaxFromConfig.HasValue)
                {
                    throw new Exception("Max receive concurrency specified both via API and configuration, please remove one of them.");
                }

                return(new PushRuntimeSettings(concurrencyLimit.MaxValue));
            }

            if (concurrencyMaxFromConfig.HasValue)
            {
                return(new PushRuntimeSettings(concurrencyMaxFromConfig.Value));
            }

            return(PushRuntimeSettings.Default);
        }