RabbitMqMessageQueue GetQueue(string queueName, bool removeExiting = false, bool oneExchangePerType = false, string inputExchange = null)
        {
            if (removeExiting)
            {
                DeleteQueue(queueName);
            }
            if (removeExiting && inputExchange != null)
            {
                DeleteExchange(inputExchange);
            }

            queuesToDelete.Add(queueName);
            var queue = new RabbitMqMessageQueue(ConnectionString, queueName);

            if (oneExchangePerType)
            {
                queue.UseExchange(null);
            }
            if (inputExchange != null)
            {
                queue.UseExchangeAsInputAddress(inputExchange);
            }
            DisposableTracker.TrackDisposable(queue);
            return(queue.PurgeInputQueue());
        }
Beispiel #2
0
        RabbitMqMessageQueue GetQueue(string queueName)
        {
            queuesToDelete.Add(queueName);
            var queue = new RabbitMqMessageQueue(ConnectionString, queueName);

            DisposableTracker.TrackDisposable(queue);
            return(queue.PurgeInputQueue());
        }
        protected RebusBus CreateBus(string inputQueueName, IActivateHandlers handlerActivator)
        {
            queuesToDelete.Add(inputQueueName);
            queuesToDelete.Add(inputQueueName + ".error");


            var bus = Configure.With(new FakeContainerAdapter(handlerActivator))
                      .Transport(x => x.UseRabbitMq(ConnectionString, inputQueueName, inputQueueName + ".error"))
                      .CreateBus() as RebusBus;

            var rabbitMqMessageQueue = new RabbitMqMessageQueue(ConnectionString, inputQueueName).PurgeInputQueue();

            DisposableTracker.TrackDisposable(rabbitMqMessageQueue);
            DisposableTracker.TrackDisposable(bus);

            return(bus);
        }
 protected T TrackDisposable <T>(T disposable) where T : IDisposable
 {
     DisposableTracker.TrackDisposable(disposable);
     return(disposable);
 }