Ejemplo n.º 1
0
        public void while_queue_is_busy_should_crash_with_timeout()
        {
            var consumer  = new WaitingConsumer(1);
            var busyQueue = new Core.Bus.QueuedHandler(consumer,
                                                       "busy_test_queue",
                                                       watchSlowMsg: false,
                                                       threadStopWaitTimeoutMs: 100);
            var waitHandle   = new ManualResetEvent(false);
            var handledEvent = new ManualResetEvent(false);

            try
            {
                busyQueue.Start();
                busyQueue.Publish(new DeferredExecutionTestMessage(() =>
                {
                    handledEvent.Set();
                    waitHandle.WaitOne();
                }));

                handledEvent.WaitOne();
                Assert.Throws <TimeoutException>(() => busyQueue.Stop());
            }
            finally
            {
                waitHandle.Set();
                consumer.Wait();

                busyQueue.Stop();
                waitHandle.Dispose();
                handledEvent.Dispose();
                consumer.Dispose();
            }
        }
Ejemplo n.º 2
0
        public void while_queue_is_busy_should_crash_with_timeout()
        {
            var consumer = new WaitingConsumer(1);
            var busyQueue = new Core.Bus.QueuedHandler(consumer,
                                                       "busy_test_queue",
                                                       watchSlowMsg: false,
                                                       threadStopWaitTimeoutMs: 100);
            var waitHandle = new ManualResetEvent(false);
            var handledEvent = new ManualResetEvent(false);
            try
            {
                busyQueue.Start();
                busyQueue.Publish(new DeferredExecutionTestMessage(() =>
                {
                    handledEvent.Set();
                    waitHandle.WaitOne();
                }));

                handledEvent.WaitOne();
                Assert.Throws<TimeoutException>(() => busyQueue.Stop());
            }
            finally
            {
                waitHandle.Set();
                consumer.Wait();

                busyQueue.Stop();
                waitHandle.Dispose();
                handledEvent.Dispose();
                consumer.Dispose();
            }
        }
Ejemplo n.º 3
0
 public override void SetUp()
 {
     _consumer = new WaitingConsumer(0);
     _queue = new Core.Bus.QueuedHandler(_consumer,"waiting_queue",watchSlowMsg: false, threadStopWaitTimeoutMs:100);
 }
Ejemplo n.º 4
0
 public override void SetUp()
 {
     _consumer = new StupidConsumer();
     _queue = new Core.Bus.QueuedHandler(_consumer, "test_name", watchSlowMsg: false, threadStopWaitTimeoutMs: 100);
 }
Ejemplo n.º 5
0
 public override void SetUp()
 {
     _consumer = new WaitingConsumer(0);
     _queue    = new Core.Bus.QueuedHandler(_consumer, "waiting_queue", watchSlowMsg: false, threadStopWaitTimeoutMs: 100);
 }
Ejemplo n.º 6
0
 public override void SetUp()
 {
     _consumer = new StupidConsumer();
     _queue    = new Core.Bus.QueuedHandler(_consumer, "test_name", watchSlowMsg: false, threadStopWaitTimeoutMs: 100);
 }