/// <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(); RegisterStandardTransport(configurer, inputQueueAddress, connectionString, settingsBuilder); return(settingsBuilder); }
/// <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 connectionString, string inputQueueAddress, ITokenProvider tokenProvider = null) { var settingsBuilder = new AzureServiceBusTransportSettings(); // register the actual transport as itself configurer .OtherService <AzureServiceBusTransport>() .Register(c => { var nameFormatter = c.Get <INameFormatter>(); var cancellationToken = c.Get <CancellationToken>(); var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var asyncTaskFactory = c.Get <IAsyncTaskFactory>(); var transport = new AzureServiceBusTransport( connectionString: connectionString, queueName: inputQueueAddress, rebusLoggerFactory: rebusLoggerFactory, asyncTaskFactory: asyncTaskFactory, nameFormatter: nameFormatter, cancellationToken: cancellationToken, tokenProvider: tokenProvider ); if (settingsBuilder.PrefetchingEnabled) { transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settingsBuilder.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settingsBuilder.PartitioningEnabled; transport.DoNotCreateQueuesEnabled = settingsBuilder.DoNotCreateQueuesEnabled; transport.DefaultMessageTimeToLive = settingsBuilder.DefaultMessageTimeToLive; transport.DoNotCheckQueueConfigurationEnabled = settingsBuilder.DoNotCheckQueueConfigurationEnabled; transport.LockDuration = settingsBuilder.LockDuration; transport.AutoDeleteOnIdle = settingsBuilder.AutoDeleteOnIdle; transport.DuplicateDetectionHistoryTimeWindow = settingsBuilder.DuplicateDetectionHistoryTimeWindow; transport.ReceiveOperationTimeout = settingsBuilder.ReceiveOperationTimeout; transport.MaximumMessagePayloadBytes = settingsBuilder.MaximumMessagePayloadBytes; return(transport); }); RegisterServices(configurer, () => settingsBuilder.LegacyNamingEnabled); // remove deferred messages step configurer.OtherService <IPipeline>().Decorate(c => { var pipeline = c.Get <IPipeline>(); return(new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof(HandleDeferredMessagesStep))); }); return(settingsBuilder); }
/// <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, AzureServiceBusMode mode = AzureServiceBusMode.Standard) { var connectionString = GetConnectionString(connectionStringNameOrConnectionString); var settingsBuilder = new AzureServiceBusTransportSettings(); if (mode == AzureServiceBusMode.Basic) { RegisterBasicTransport(configurer, inputQueueAddress, connectionString, settingsBuilder); } else { RegisterStandardTransport(configurer, inputQueueAddress, connectionString, settingsBuilder); } return(settingsBuilder); }
/// <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; }
/// <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); }
static void RegisterBasicTransport(StandardConfigurer <ITransport> configurer, string inputQueueAddress, string connectionString, AzureServiceBusTransportSettings settings) { configurer.Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var asyncTaskFactory = c.Get <IAsyncTaskFactory>(); var transport = new BasicAzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory, asyncTaskFactory); if (settings.PrefetchingEnabled) { transport.PrefetchMessages(settings.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settings.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settings.PartitioningEnabled; transport.DoNotCreateQueuesEnabled = settings.DoNotCreateQueuesEnabled; return(transport); }); }
static void RegisterStandardTransport(StandardConfigurer <ITransport> configurer, string inputQueueAddress, string connectionString, AzureServiceBusTransportSettings settings) { // register the actual transport as itself configurer .OtherService <AzureServiceBusTransport>() .Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var asyncTaskFactory = c.Get <IAsyncTaskFactory>(); var transport = new AzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory, asyncTaskFactory); if (settings.PrefetchingEnabled) { transport.PrefetchMessages(settings.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settings.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settings.PartitioningEnabled; transport.DoNotCreateQueuesEnabled = settings.DoNotCreateQueuesEnabled; return(transport); }); // map subscription storage to transport configurer .OtherService <ISubscriptionStorage>() .Register(c => c.Get <AzureServiceBusTransport>(), description: AsbSubStorageText); // map ITransport to transport configurer.Register(c => c.Get <AzureServiceBusTransport>()); // remove deferred messages step configurer.OtherService <IPipeline>().Decorate(c => { var pipeline = c.Get <IPipeline>(); return(new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof(HandleDeferredMessagesStep))); }); // disable timeout manager configurer.OtherService <ITimeoutManager>() .Register(c => new DisabledTimeoutManager(), description: AsbTimeoutManagerText); }
/// <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, AzureServiceBusMode mode = AzureServiceBusMode.Standard) { var connectionString = GetConnectionString(connectionStringNameOrConnectionString); var settingsBuilder = new AzureServiceBusTransportSettings(); if (mode == AzureServiceBusMode.Basic) { configurer.Register(c => { var rebusLoggerFactory = c.Get<IRebusLoggerFactory>(); var asyncTaskFactory = c.Get<IAsyncTaskFactory>(); var transport = new BasicAzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory, asyncTaskFactory); if (settingsBuilder.PrefetchingEnabled) { transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settingsBuilder.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settingsBuilder.PartitioningEnabled; return transport; }); return settingsBuilder; } configurer .OtherService<AzureServiceBusTransport>() .Register(c => { var rebusLoggerFactory = c.Get<IRebusLoggerFactory>(); var asyncTaskFactory = c.Get<IAsyncTaskFactory>(); var transport = new AzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory, asyncTaskFactory); if (settingsBuilder.PrefetchingEnabled) { transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settingsBuilder.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settingsBuilder.PartitioningEnabled; return transport; }); configurer .OtherService<ISubscriptionStorage>() .Register(c => c.Get<AzureServiceBusTransport>(), description: AsbSubStorageText); configurer.Register(c => c.Get<AzureServiceBusTransport>()); configurer.OtherService<IPipeline>().Decorate(c => { var pipeline = c.Get<IPipeline>(); return new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof(HandleDeferredMessagesStep)); }); configurer.OtherService<ITimeoutManager>().Register(c => new DisabledTimeoutManager(), description: AsbTimeoutManagerText); return settingsBuilder; }
/// <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, AzureServiceBusMode mode = AzureServiceBusMode.Standard) { var connectionString = GetConnectionString(connectionStringNameOrConnectionString); var settingsBuilder = new AzureServiceBusTransportSettings(); if (mode == AzureServiceBusMode.Basic) { configurer.Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var transport = new BasicAzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory); if (settingsBuilder.PrefetchingEnabled) { transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settingsBuilder.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settingsBuilder.PartitioningEnabled; return(transport); }); return(settingsBuilder); } configurer .OtherService <AzureServiceBusTransport>() .Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var transport = new AzureServiceBusTransport(connectionString, inputQueueAddress, rebusLoggerFactory); if (settingsBuilder.PrefetchingEnabled) { transport.PrefetchMessages(settingsBuilder.NumberOfMessagesToPrefetch); } transport.AutomaticallyRenewPeekLock = settingsBuilder.AutomaticPeekLockRenewalEnabled; transport.PartitioningEnabled = settingsBuilder.PartitioningEnabled; return(transport); }); configurer .OtherService <ISubscriptionStorage>() .Register(c => c.Get <AzureServiceBusTransport>(), description: AsbSubStorageText); configurer.Register(c => c.Get <AzureServiceBusTransport>()); configurer.OtherService <IPipeline>().Decorate(c => { var pipeline = c.Get <IPipeline>(); return(new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof(HandleDeferredMessagesStep))); }); configurer.OtherService <ITimeoutManager>().Register(c => new DisabledTimeoutManager(), description: AsbTimeoutManagerText); return(settingsBuilder); }