Example #1
0
        /// <summary>
        /// Configures Rebus to use Azure Service Bus queues to transport messages, connecting to the service bus instance pointed to by the connection string
        /// (or the connection string with the specified name from the current app.config)
        /// </summary>
        public static AzureServiceBusTransportSettings UseAzureServiceBus(this StandardConfigurer <ITransport> configurer, string connectionStringNameOrConnectionString, string inputQueueAddress)
        {
            var connectionString = GetConnectionString(connectionStringNameOrConnectionString);
            var settingsBuilder  = new AzureServiceBusTransportSettings();

            configurer.Register(c =>
            {
                var transport = new AzureServiceBusTransport(connectionString, inputQueueAddress);

                if (settingsBuilder.PrefetchingEnabled)
                {
                    transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch);
                }

                if (settingsBuilder.AutomaticPeekLockRenewalEnabled)
                {
                    transport.AutomaticallyRenewPeekLock();
                }

                return(transport);
            });

            return(settingsBuilder);
        }