示例#1
0
        public ITransport Create(string inputQueueAddress)
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(false);
            var asyncTaskFactory     = new TplAsyncTaskFactory(consoleLoggerFactory);

            if (inputQueueAddress == null)
            {
                var transport = new AzureServiceBusTransport(ConnectionString, null, consoleLoggerFactory, asyncTaskFactory);

                transport.Initialize();

                return(transport);
            }

            return(_queuesToDelete.GetOrAdd(inputQueueAddress, () =>
            {
                var transport = new BasicAzureServiceBusTransport(ConnectionString, inputQueueAddress, consoleLoggerFactory, asyncTaskFactory);

                transport.PurgeInputQueue();

                transport.Initialize();

                return transport;
            }));
        }
        ITransport GetTransport()
        {
            if (_mode == AzureServiceBusMode.Basic)
            {
                var basicTransport = new BasicAzureServiceBusTransport(StandardAzureServiceBusTransportFactory.ConnectionString, _queueName, new ConsoleLoggerFactory(false));
                basicTransport.Initialize();
                basicTransport.PurgeInputQueue();
                return(basicTransport);
            }
            var transport = new AzureServiceBusTransport(StandardAzureServiceBusTransportFactory.ConnectionString, _queueName, new ConsoleLoggerFactory(false));

            Using(transport);
            transport.Initialize();
            transport.PurgeInputQueue();
            return(transport);
        }
        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);
            });
        }
        public ITransport Create(string inputQueueAddress)
        {
            if (inputQueueAddress == null)
            {
                var transport = new AzureServiceBusTransport(ConnectionString, null, new ConsoleLoggerFactory(false));

                transport.Initialize();

                return transport;
            }

            return _queuesToDelete.GetOrAdd(inputQueueAddress, () =>
            {
                var transport = new BasicAzureServiceBusTransport(ConnectionString, inputQueueAddress, new ConsoleLoggerFactory(false));

                transport.PurgeInputQueue();

                transport.Initialize();

                return transport;
            });
        }
示例#5
0
        ITransport GetTransport()
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(false);
            var asyncTaskFactory     = new TplAsyncTaskFactory(consoleLoggerFactory);
            var connectionString     = StandardAzureServiceBusTransportFactory.ConnectionString;
            var busLifetimeEvents    = new BusLifetimeEvents();

            if (_mode == AzureServiceBusMode.Basic)
            {
                var basicTransport = new BasicAzureServiceBusTransport(connectionString, _queueName, consoleLoggerFactory, asyncTaskFactory);
                Using(basicTransport);
                basicTransport.Initialize();
                basicTransport.PurgeInputQueue();
                return(basicTransport);
            }
            var transport = new AzureServiceBusTransport(connectionString, _queueName, consoleLoggerFactory, asyncTaskFactory);

            Using(transport);
            transport.Initialize();
            transport.PurgeInputQueue();
            return(transport);
        }
        ITransport GetTransport()
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(false);
            var asyncTaskFactory = new TplAsyncTaskFactory(consoleLoggerFactory);
            var connectionString = StandardAzureServiceBusTransportFactory.ConnectionString;
            var busLifetimeEvents = new BusLifetimeEvents();

            if (_mode == AzureServiceBusMode.Basic)
            {
                var basicTransport = new BasicAzureServiceBusTransport(connectionString, _queueName, consoleLoggerFactory, asyncTaskFactory, busLifetimeEvents);
                Using(basicTransport);
                basicTransport.Initialize();
                basicTransport.PurgeInputQueue();
                return basicTransport;
            }
            var transport = new AzureServiceBusTransport(connectionString, _queueName, consoleLoggerFactory, asyncTaskFactory, busLifetimeEvents);
            Using(transport);
            transport.Initialize();
            transport.PurgeInputQueue();
            return transport;
        }
示例#7
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, 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);
        }
        public ITransport Create(string inputQueueAddress)
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(false);
            var asyncTaskFactory = new TplAsyncTaskFactory(consoleLoggerFactory);
            if (inputQueueAddress == null)
            {
                var transport = new AzureServiceBusTransport(ConnectionString, null, consoleLoggerFactory, asyncTaskFactory, new BusLifetimeEvents());

                transport.Initialize();

                return transport;
            }

            return _queuesToDelete.GetOrAdd(inputQueueAddress, () =>
            {
                var transport = new BasicAzureServiceBusTransport(ConnectionString, inputQueueAddress, consoleLoggerFactory, asyncTaskFactory, new BusLifetimeEvents());

                transport.PurgeInputQueue();

                transport.Initialize();

                return transport;
            });
        }
 ITransport GetTransport()
 {
     if (_mode == AzureServiceBusMode.Basic)
     {
         var basicTransport = new BasicAzureServiceBusTransport(StandardAzureServiceBusTransportFactory.ConnectionString, _queueName, new ConsoleLoggerFactory(false));
         basicTransport.Initialize();
         basicTransport.PurgeInputQueue();
         return basicTransport;
     }
     var transport = new AzureServiceBusTransport(StandardAzureServiceBusTransportFactory.ConnectionString, _queueName, new ConsoleLoggerFactory(false));
     Using(transport);
     transport.Initialize();
     transport.PurgeInputQueue();
     return transport;
 }