public void WorksWhenMovingToErrorQueue()
        {
            using (var messageQueue = new MsmqMessageQueue("error"))
            {
                // make sure error queue is empty
                messageQueue.PurgeInputQueue();

                adapter.Handle<Request>(req =>
                {
                    throw new ApplicationException("oh crap");
                });

                var request = new Request();
                bus.AttachHeader(request, Headers.CorrelationId, "super-unique!!!!111");
                bus.SendLocal(request);

                // let it fail
                Thread.Sleep(2.Seconds());

                var receivedTransportMessage = messageQueue.ReceiveMessage(new NoTransaction());
                receivedTransportMessage.ShouldNotBe(null);

                var serializer = new JsonMessageSerializer();
                var message = serializer.Deserialize(receivedTransportMessage);

                message.Headers.ShouldContainKeyAndValue(Headers.CorrelationId, "super-unique!!!!111");
            }
        }
Esempio n. 2
0
 static void PurgeInputQueue(string inputQueueName)
 {
     using (var queue = new MsmqMessageQueue(inputQueueName))
     {
         queue.PurgeInputQueue();
     }
 }
Esempio n. 3
0
        protected override void DoSetUp()
        {
            serializer = new JsonMessageSerializer();
            senderQueue = new MsmqMessageQueue(SenderQueueName);

            destinationQueue = NewRawMsmqQueue(DestinationQueueName);

            senderQueue.PurgeInputQueue();
            destinationQueue.Purge();

            TrackDisposable(senderQueue);
        }
Esempio n. 4
0
        public void SetUp()
        {
            disposables = new List<IDisposable>();

            serializer = new JsonMessageSerializer();
            senderQueue = new MsmqMessageQueue("test.msmq.tx.sender");
            destinationQueueName = "test.msmq.tx.destination";

            destinationQueue = NewRawMsmqQueue(destinationQueueName);

            senderQueue.PurgeInputQueue();
            destinationQueue.Purge();

            disposables.Add(senderQueue);
            disposables.Add(destinationQueue);
        }
Esempio n. 5
0
        public void SetUp()
        {
            serializer = new JsonMessageSerializer();
            senderQueue = new MsmqMessageQueue("test.msmq.tx.sender", "error");
            destinationQueueName = "test.msmq.tx.destination";
            destinationQueuePath = MsmqMessageQueue.PrivateQueue(destinationQueueName);

            if (!MessageQueue.Exists(destinationQueuePath))
            {
                var messageQueue = MessageQueue.Create(destinationQueuePath, transactional: true);
                messageQueue.SetPermissions(Thread.CurrentPrincipal.Identity.Name, MessageQueueAccessRights.FullControl);
            }

            destinationQueue = new MessageQueue(destinationQueuePath)
                                   {
                                       Formatter = new RebusTransportMessageFormatter(),
                                       MessageReadPropertyFilter = RebusTransportMessageFormatter.PropertyFilter,
                                   };

            senderQueue.PurgeInputQueue();
            destinationQueue.Purge();
        }
        public void SetUp()
        {
            serializer = new JsonMessageSerializer();
            senderQueue = new MsmqMessageQueue(MsmqMessageQueue.PrivateQueue("test.msmq.tx.sender"));
            destinationQueuePath = MsmqMessageQueue.PrivateQueue("test.msmq.tx.destination");

            if (!MessageQueue.Exists(destinationQueuePath))
                MessageQueue.Create(destinationQueuePath, transactional: true);

            destinationQueue = new MessageQueue(destinationQueuePath)
                                   {
                                       Formatter = new RebusTransportMessageFormatter()
                                   };

            senderQueue.PurgeInputQueue();
            destinationQueue.Purge();
        }