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");
            }
        }
Exemple #2
0
 static void PurgeInputQueue(string inputQueueName)
 {
     using (var queue = new MsmqMessageQueue(inputQueueName))
     {
         queue.PurgeInputQueue();
     }
 }
Exemple #3
0
        protected override void DoSetUp()
        {
            serializer  = new JsonMessageSerializer();
            senderQueue = new MsmqMessageQueue(SenderQueueName);

            destinationQueue = NewRawMsmqQueue(DestinationQueueName);

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

            TrackDisposable(senderQueue);
        }
Exemple #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);
        }