Ejemplo n.º 1
0
 static void PurgeInputQueue(string inputQueueName)
 {
     using (var transport = new RabbitMqTransport(RabbitMqConnectionString, inputQueueName, new NullLoggerFactory()))
     {
         transport.PurgeInputQueue();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Configures Rebus to use RabbitMQ to move messages around
        /// </summary>
        public static RabbitMqOptionsBuilder UseRabbitMq(this StandardConfigurer <ITransport> configurer, string connectionString, string inputQueueName)
        {
            var options = new RabbitMqOptionsBuilder();

            configurer
            .OtherService <RabbitMqTransport>()
            .Register(c =>
            {
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();
                var transport          = new RabbitMqTransport(connectionString, inputQueueName, rebusLoggerFactory);

                if (options.NumberOfMessagesToprefetch.HasValue)
                {
                    transport.SetPrefetching(options.NumberOfMessagesToprefetch.Value);
                }

                return(transport);
            });

            configurer
            .OtherService <ISubscriptionStorage>()
            .Register(c => c.Get <RabbitMqTransport>(), description: RabbitMqSubText);

            configurer.Register(c => c.Get <RabbitMqTransport>());

            return(options);
        }
Ejemplo n.º 3
0
        internal void Configure(RabbitMqTransport transport)
        {
            transport.AddClientProperties(_additionalClientProperties);

            if (DeclareExchanges.HasValue)
            {
                transport.SetDeclareExchanges(DeclareExchanges.Value);
            }

            if (DeclareInputQueue.HasValue)
            {
                transport.SetDeclareInputQueue(DeclareInputQueue.Value);
            }

            if (BindInputQueue.HasValue)
            {
                transport.SetBindInputQueue(BindInputQueue.Value);
            }

            if (DirectExchangeName != null)
            {
                transport.SetDirectExchangeName(DirectExchangeName);
            }

            if (TopicExchangeName != null)
            {
                transport.SetTopicExchangeName(TopicExchangeName);
            }

            if (MaxNumberOfMessagesToPrefetch != null)
            {
                transport.SetMaxMessagesToPrefetch(MaxNumberOfMessagesToPrefetch.Value);
            }
        }
        /// <summary>
        /// Configures Rebus to use RabbitMQ to move messages around
        /// </summary>
        public static RabbitMqOptionsBuilder UseRabbitMq(this StandardConfigurer<ITransport> configurer,  string connectionString, string inputQueueName)
        {
            var options = new RabbitMqOptionsBuilder();

            configurer
                .OtherService<RabbitMqTransport>()
                .Register(c =>
                {
                    var transport = new RabbitMqTransport(connectionString, inputQueueName);

                    if (options.NumberOfMessagesToprefetch.HasValue)
                    {
                        transport.SetPrefetching(options.NumberOfMessagesToprefetch.Value);
                    }

                    return transport;
                });

            configurer
                .OtherService<ISubscriptionStorage>()
                .Register(c => c.Get<RabbitMqTransport>(), description: RabbitMqSubText);

            configurer.Register(c => c.Get<RabbitMqTransport>());

            return options;
        }
Ejemplo n.º 5
0
        protected override void DoRun()
        {
            using (var transport = new RabbitMqTransport(GetConnectionString(HostnameOrConnectionString), InputQueue))
            {
                var returnToSourceQueue = new ReturnToSourceQueue(transport)
                {
                    InputQueue = InputQueue,
                    DefaultOutputQueue = DefaultOutputQueue
                };

                returnToSourceQueue.Run();
            }
        }
        /// <summary>
        /// Configures Rebus to use RabbitMQ to move messages around
        /// </summary>
        public static RabbitMqOptionsBuilder UseRabbitMq(this StandardConfigurer<ITransport> configurer,  string connectionString, string inputQueueName)
        {
            var options = new RabbitMqOptionsBuilder();

            configurer
                .OtherService<RabbitMqTransport>()
                .Register(c =>
                {
                    var rebusLoggerFactory = c.Get<IRebusLoggerFactory>();
                    var transport = new RabbitMqTransport(connectionString, inputQueueName, rebusLoggerFactory);
                    options.Configure(transport);
                    return transport;
                });

            configurer
                .OtherService<ISubscriptionStorage>()
                .Register(c => c.Get<RabbitMqTransport>(), description: RabbitMqSubText);

            configurer.Register(c => c.Get<RabbitMqTransport>());

            return options;
        }
        /// <summary>
        /// Configures Rebus to use RabbitMQ to transport messages as a one-way client (i.e. will not be able to receive any messages)
        /// </summary>
        public static RabbitMqOptionsBuilder UseRabbitMqAsOneWayClient(this StandardConfigurer<ITransport> configurer, string connectionString)
        {
            var options = new RabbitMqOptionsBuilder();

            configurer
                .OtherService<RabbitMqTransport>()
                .Register(c =>
                {
                    var rebusLoggerFactory = c.Get<IRebusLoggerFactory>();
                    var transport = new RabbitMqTransport(connectionString, null, rebusLoggerFactory);
                    options.Configure(transport);
                    return transport;
                });

            configurer
                .OtherService<ISubscriptionStorage>()
                .Register(c => c.Get<RabbitMqTransport>(), description: RabbitMqSubText);

            configurer.Register(c => c.Get<RabbitMqTransport>());

            OneWayClientBackdoor.ConfigureOneWayClient(configurer);

            return options;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Configures Rebus to use RabbitMQ to transport messages as a one-way client (i.e. will not be able to receive any messages)
        /// </summary>
        public static RabbitMqOptionsBuilder UseRabbitMqAsOneWayClient(this StandardConfigurer <ITransport> configurer, string connectionString)
        {
            var options = new RabbitMqOptionsBuilder();

            configurer
            .OtherService <RabbitMqTransport>()
            .Register(c =>
            {
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();
                var transport          = new RabbitMqTransport(connectionString, null, rebusLoggerFactory);
                options.Configure(transport);
                return(transport);
            });

            configurer
            .OtherService <ISubscriptionStorage>()
            .Register(c => c.Get <RabbitMqTransport>(), description: RabbitMqSubText);

            configurer.Register(c => c.Get <RabbitMqTransport>());

            OneWayClientBackdoor.ConfigureOneWayClient(configurer);

            return(options);
        }
Ejemplo n.º 9
0
        internal void Configure(RabbitMqTransport transport)
        {
            transport.AddClientProperties(_additionalClientProperties);

            if (DeclareExchanges.HasValue)
            {
                transport.SetDeclareExchanges(DeclareExchanges.Value);
            }

            if (DeclareInputQueue.HasValue)
            {
                transport.SetDeclareInputQueue(DeclareInputQueue.Value);
            }

            if (BindInputQueue.HasValue)
            {
                transport.SetBindInputQueue(BindInputQueue.Value);
            }

            if (DirectExchangeName != null)
            {
                transport.SetDirectExchangeName(DirectExchangeName);
            }

            if (TopicExchangeName != null)
            {
                transport.SetTopicExchangeName(TopicExchangeName);
            }

            if (MaxNumberOfMessagesToPrefetch != null)
            {
                transport.SetMaxMessagesToPrefetch(MaxNumberOfMessagesToPrefetch.Value);
            }
        }