RabbitMqMessageQueue GetQueue(string queueName)
 {
     var queue = new RabbitMqMessageQueue(RabbitMqFixtureBase.ConnectionString, queueName, queueName + ".error");
     queue.PurgeInputQueue();
     disposables.Add(queue);
     return queue;
 }
 protected override void DoSetUp()
 {
     using (var queue = new RabbitMqMessageQueue(ConnectionString, InputQueueName))
     {
         queue.PurgeInputQueue();
     }
 }
Example #3
0
        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();
        }
Example #4
0
        public void CanSendToQueueWithEmptyExchangeAfterAtSign()
        {
            const string recipientInputQueueName = "test.atsimbol.recipient@";
            const string senderInputQueueName = "test.atsimbol.sender";

            using (var recipientQueue = new RabbitMqMessageQueue(ConnectionString, recipientInputQueueName))
            using (var senderQueue = new RabbitMqMessageQueue(ConnectionString, senderInputQueueName))
            {
                recipientQueue.PurgeInputQueue();
                senderQueue.PurgeInputQueue();

                var id = Guid.NewGuid();
                senderQueue.Send(recipientInputQueueName,
                                 serializer.Serialize(new Message
                                 {
                                     Messages = new object[] { "HELLO WORLD!" },
                                     Headers =
                                         new Dictionary<string, object> { 
                                            { Headers.MessageId, id.ToString() }
                                         },
                                 }),
                                 new NoTransaction());

                // act
                Thread.Sleep(2.Seconds() + 1.Seconds());

                // assert
                var receivedTransportMessage = recipientQueue.ReceiveMessage(new NoTransaction());
                Assert.That(receivedTransportMessage, Is.Not.Null);
            }
        }
Example #5
0
        public void TransportLevelMessageIdIsPreserved()
        {
            const string recipientInputQueueName = "test.tlid.recipient";
            const string senderInputQueueName = "test.tlid.sender";

            using (var recipientQueue = new RabbitMqMessageQueue(ConnectionString, recipientInputQueueName))
            using (var senderQueue = new RabbitMqMessageQueue(ConnectionString, senderInputQueueName))
            {
                recipientQueue.PurgeInputQueue();
                senderQueue.PurgeInputQueue();

                var id = Guid.NewGuid();
                senderQueue.Send(recipientInputQueueName,
                                 serializer.Serialize(new Message
                                 {
                                     Messages = new object[] { "HELLO WORLD!" },
                                     Headers =
                                         new Dictionary<string, object> { 
                                            { Headers.MessageId, id.ToString() }
                                         },
                                 }),
                                 new NoTransaction());

                // act
                Thread.Sleep(2.Seconds() + 1.Seconds());

                // assert
                var receivedTransportMessage = recipientQueue.ReceiveMessage(new NoTransaction());
                Assert.That(receivedTransportMessage, Is.Not.Null);
                Assert.That(receivedTransportMessage.Headers, Is.Not.Null);
                Assert.That(receivedTransportMessage.Headers.ContainsKey(Headers.MessageId), Is.True);
                Assert.That(receivedTransportMessage.Headers[Headers.MessageId], Is.EqualTo(id.ToString()));
            }
        }
 RabbitMqMessageQueue GetQueue(string queueName)
 {
     queuesToDelete.Add(queueName);
     var queue = new RabbitMqMessageQueue(ConnectionString, queueName);
     DisposableTracker.TrackDisposable(queue);
     return queue.PurgeInputQueue();
 }
 RabbitMqMessageQueue GetQueue(string queueName)
 {
     var queue = new RabbitMqMessageQueue(ConnectionString, queueName, queueName + ".error");
     toDispose.Add(queue);
     return queue.PurgeInputQueue();
 }