public void SetupReceivedMessages() { var logger = new RecordingLogger(); sender = ObjectMother.QueueManager(logger: logger); sender.Start(); using (var tx = new TransactionScope()) { sender.Send( new Uri("lq.tcp://localhost:23457/h"), new MessagePayload { Data = new byte[] { 6, 7, 8, 9 } }); tx.Complete(); } receiver = ObjectMother.QueueManager("test2", 23457); receiver.CreateQueues("a"); receiver.Start(); sender.WaitForAllMessagesToBeSent(); sender.Dispose(); receiver.Dispose(); sender = ObjectMother.QueueManager(delete: false); receiver = ObjectMother.QueueManager("test2", 23457, delete: false); receiver.CreateQueues("a"); }
public void MessageSent_EventIsRaised() { using (var receiver = ObjectMother.QueueManager(TEST_QUEUE_2, 23457)) { receiver.Start(); using (var tx = new TransactionScope()) { _sender.Send( new Uri("lq.tcp://localhost:23457/h"), new MessagePayload { Data = new byte[] { 1, 2, 4, 5 } }); tx.Complete(); } _sender.WaitForAllMessagesToBeSent(); } var log = _logger.DebugMessages.OfType <MessagesSent>().FirstOrDefault(); log.ShouldNotBeNull(); "localhost".ShouldEqual(log.Destination.Host); 23457.ShouldEqual(log.Destination.Port); "h".ShouldEqual(log.Messages[0].Queue); }
public void Setup() { _logger = new RecordingLogger(); _sender = ObjectMother.QueueManager(); _sender.Start(); _receiver = ObjectMother.QueueManager("test2", 23457, logger: _logger); _receiver.Start(); }
public void ThrowsWhenAlreadyInUse() { var one = ObjectMother.QueueManager(); var two = ObjectMother.QueueManager("test2"); one.Start(); typeof(EndpointInUseException).ShouldBeThrownBy(two.Start); }
public void Setup() { _sender = ObjectMother.QueueManager(); _sender.Start(); _receiver = ObjectMother.QueueManager("test2", 23457); _receiver.CreateQueues("a"); _receiver.Start(); }
public void rollback_on_send_does_not_send_message() { var sender = ObjectMother.QueueManager("test2", 23457); var sendingScope = sender.BeginTransactionalScope(); sendingScope.Send(ObjectMother.UriFor(23456), ObjectMother.MessagePayload()); sendingScope.Rollback(); var receivingScope = queueManager.BeginTransactionalScope(); Assert.Throws <TimeoutException>(() => receivingScope.Receive("h", TimeSpan.FromSeconds(1))); sender.Dispose(); }
public void Setup() { _queue = ObjectMother.QueueManager(); _queue.Start(); _receiver = ObjectMother.QueueManager("test2", 23457); using (var tx = new TransactionScope()) { _messageId = _queue.Send( new Uri("lq.tcp://localhost:23457/h"), new MessagePayload { Data = new byte[] { 1, 2, 4, 5 } }); tx.Complete(); } }
public void CanPurgeLargeSetsOfOldData() { queueManager = ObjectMother.QueueManager(); queueManager.Configuration.OldestMessageInOutgoingHistory = TimeSpan.Zero; queueManager.Start(); // Seed the queue with historical messages to be purged QueueMessagesThreaded(1000); //Parallel.For(0, 1000, new ParallelOptions { MaxDegreeOfParallelism = 8 }, i => SendMessages()); queueManager.WaitForAllMessagesToBeSent(); // Try to purge while still sending new messages. var waitHandle = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(_ => { queueManager.PurgeOldData(); Console.WriteLine("Finished purging data"); waitHandle.Set(); }); QueueMessagesThreaded(10000); //var purgeTask = Task.Factory.StartNew(() => //{ // queueManager.PurgeOldData(); // Console.WriteLine("Finished purging data"); //}); //Parallel.For(0, 10000, new ParallelOptions { MaxDegreeOfParallelism = 8 }, i => SendMessages()); waitHandle.WaitOne(); //purgeTask.Wait(); queueManager.WaitForAllMessagesToBeSent(); queueManager.PurgeOldData(); queueManager.Configuration.NumberOfMessagesToKeepInOutgoingHistory.ShouldEqual( queueManager.GetAllSentMessages().Length); }
private void SetupUnstarted() { sender = ObjectMother.QueueManager(); receiver = ObjectMother.QueueManager("test2", 23457); receiver.CreateQueues("a"); }
public void Setup() { _logger = new RecordingLogger(); _sender = ObjectMother.QueueManager(logger: _logger); _sender.Start(); }
public void SetUp() { queueManager = ObjectMother.QueueManager(); queueManager.Start(); }
public void Setup() { queueManager = ObjectMother.QueueManager(); }
public void Setup() { _sender = ObjectMother.QueueManager(); _receiver = ObjectMother.QueueManager("test2", 23457); }