Пример #1
0
        public void Duplex()
        {
            var host = new ServiceHost(typeof(OrderService), new Uri("soap.amqp:///"));

            var binding = new RabbitMQBinding(Constants.HostName, Constants.MainPort);

            host.AddServiceEndpoint(typeof(IOrderService), binding, "OrderService");

            host.Open();

            var callback = new OrderCallback();
            var client   = DuplexChannelFactory <IOrderService> .CreateChannel(callback,
                                                                               binding,
                                                                               new EndpointAddress("soap.amqp:///OrderService"));

            client.Order();

            callback.Semaphore.WaitOne(500);
            Assert.IsTrue(callback.Completed);

            host.Close();
        }
Пример #2
0
        public void Duplex()
        {
            var host = new ServiceHost(typeof(OrderService), new Uri("soap.amqp:///"));

            var binding = new RabbitMQBinding(Constants.HostName, Constants.MainPort);

            host.AddServiceEndpoint(typeof(IOrderService), binding, "OrderService");

            host.Open();

            var callback = new OrderCallback();
            var client = DuplexChannelFactory<IOrderService>.CreateChannel(callback,
                                                                           binding,
                                                                           new EndpointAddress("soap.amqp:///OrderService"));

            client.Order();

            callback.Semaphore.WaitOne(500);
            Assert.IsTrue(callback.Completed);

            host.Close();
        }