Пример #1
0
        public static ServiceBusRuntime BinaryMsmqRuntime()
        {
            // Drop test queues if they already exist
            if (MsmqMessageDeliveryQueue.Exists(_testQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_testQueuePath);
            }
            if (MsmqMessageDeliveryQueue.Exists(_retryQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_retryQueuePath);
            }
            if (MsmqMessageDeliveryQueue.Exists(_failQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_failQueuePath);
            }

            // Create test queues
            MsmqMessageDeliveryQueue.Create(_testQueuePath);
            MsmqMessageDeliveryQueue.Create(_retryQueuePath);
            MsmqMessageDeliveryQueue.Create(_failQueuePath);

            var binaryFormatter = new System.Messaging.BinaryMessageFormatter();
            MsmqMessageDeliveryQueue testQueue  = new MsmqMessageDeliveryQueue(_testQueuePath, binaryFormatter);
            MsmqMessageDeliveryQueue retryQueue = new MsmqMessageDeliveryQueue(_retryQueuePath, binaryFormatter);
            MsmqMessageDeliveryQueue failQueue  = new MsmqMessageDeliveryQueue(_failQueuePath, binaryFormatter);

            return(new ServiceBusRuntime(new QueuedDeliveryCore(testQueue, retryQueue, failQueue)));
        }
Пример #2
0
        public static ServiceBusRuntime MsmqRuntime <T>()
        {
            // Drop test queues if they already exist
            if (MsmqMessageDeliveryQueue.Exists(_testQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_testQueuePath);
            }
            if (MsmqMessageDeliveryQueue.Exists(_retryQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_retryQueuePath);
            }
            if (MsmqMessageDeliveryQueue.Exists(_failQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(_failQueuePath);
            }

            // Create test queues
            MsmqMessageDeliveryQueue.Create(_testQueuePath);
            MsmqMessageDeliveryQueue.Create(_retryQueuePath);
            MsmqMessageDeliveryQueue.Create(_failQueuePath);


            BinaryMessageEncodingBindingElement element = new BinaryMessageEncodingBindingElement();
            MessageEncoder encoder = element.CreateMessageEncoderFactory().Encoder;

            MessageDeliveryFormatter formatter = new MessageDeliveryFormatter(new ConverterMessageDeliveryReaderFactory(encoder, typeof(T)), new ConverterMessageDeliveryWriterFactory(encoder, typeof(T)));

            MsmqMessageDeliveryQueue testQueue  = new MsmqMessageDeliveryQueue(_testQueuePath, formatter);
            MsmqMessageDeliveryQueue retryQueue = new MsmqMessageDeliveryQueue(_retryQueuePath, formatter);
            MsmqMessageDeliveryQueue failQueue  = new MsmqMessageDeliveryQueue(_failQueuePath, formatter);

            return(new ServiceBusRuntime(new QueuedDeliveryCore(testQueue, retryQueue, failQueue)));
        }
 public void Can_Create_Queue()
 {
     if (MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath))
     {
         MsmqMessageDeliveryQueue.Delete(Config.TestQueuePath);
     }
     MsmqMessageDeliveryQueue.Create(Config.TestQueuePath);
 }
 public void Can_Delete_Queue()
 {
     if (!MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath))
     {
         MsmqMessageDeliveryQueue.Create(Config.TestQueuePath);
     }
     MsmqMessageDeliveryQueue.Delete(Config.TestQueuePath);
     Assert.IsFalse(MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath));
 }
Пример #5
0
        void recreateQueue()
        {
            // Delete test queues if they already exist

            if (MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath))
            {
                MsmqMessageDeliveryQueue.Delete(Config.TestQueuePath);
            }
            // Create test queue
            MsmqMessageDeliveryQueue.Create(Config.TestQueuePath);
        }
 public void Can_Check_Queue_Existence()
 {
     if (MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath))
     {
         MsmqMessageDeliveryQueue.Delete(Config.TestQueuePath);
     }
     MsmqMessageDeliveryQueue.Create(Config.TestQueuePath);
     Assert.IsTrue(MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath));
     MsmqMessageDeliveryQueue.Delete(Config.TestQueuePath);
     Assert.IsFalse(MsmqMessageDeliveryQueue.Exists(Config.TestQueuePath));
 }