예제 #1
0
#pragma warning disable 618
        public static void ConfigureTransport(this TransportExtensions <AzureServiceBusTransport> transport, TransportSettings transportSettings, TransportTransactionMode transactionMode)
#pragma warning restore 618
        {
            //If the custom part stays in the connection string and is at the end, the sdk will treat is as part of the SharedAccessKey
            var connectionString = ConnectionStringPartRemover.Remove(transportSettings.ConnectionString, QueueLengthProvider.QueueLengthQueryIntervalPartName);

            transport.ConnectionString(connectionString);
            transport.Transactions(transactionMode);
            transport.Queues().LockDuration(TimeSpan.FromMinutes(5));
            transport.Subscriptions().LockDuration(TimeSpan.FromMinutes(5));
            transport.MessagingFactories().NumberOfMessagingFactoriesPerNamespace(2);
            transport.NumberOfClientsPerEntity(Math.Min(Environment.ProcessorCount, transportSettings.MaxConcurrency));
        }
예제 #2
0
        public void Initialize(string connectionString, Action <QueueLengthEntry[], EndpointToQueueMapping> store)
        {
            var builder = new DbConnectionStringBuilder {
                ConnectionString = connectionString
            };

            if (builder.TryGetValue(QueueLengthQueryIntervalPartName, out var value))
            {
                if (int.TryParse(value.ToString(), out var queryDelayInterval))
                {
                    QueryDelayInterval = TimeSpan.FromMilliseconds(queryDelayInterval);
                }
                else
                {
                    Logger.Warn($"Can't parse {value} as a valid query delay interval.");
                }

                //If the custom part stays in the connection string and is at the end, the sdk will treat is as part of the SharedAccessKey
                connectionString = ConnectionStringPartRemover.Remove(connectionString, QueueLengthQueryIntervalPartName);
            }

            this.store            = store;
            this.namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
        }