public void Should_be_able_to_make_many_async_requests() { const int numberOfCalls = 500; var countdownEvent = new CountdownEvent(numberOfCalls); var count = 0; for (int i = 0; i < 1000; i++) { var request = new TestAsyncRequestMessage { Text = "Hello async from the client! " + i }; using (var publishChannel = bus.OpenPublishChannel()) { publishChannel.Request <TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => { Console.Out.WriteLine("response = {0}", response.Text); Interlocked.Increment(ref count); countdownEvent.Signal(); }); } } countdownEvent.Wait(10000); count.ShouldEqual(numberOfCalls); }
public void Should_be_able_to_make_a_request_that_runs_async_on_the_server() { var request = new TestAsyncRequestMessage { Text = "Hello async from the client!" }; Console.Out.WriteLine("Making request"); bus.Request <TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => Console.Out.WriteLine("response = {0}", response.Text)); Thread.Sleep(2000); }
public void Should_be_able_to_make_many_async_requests() { for (int i = 0; i < 1000; i++) { var request = new TestAsyncRequestMessage { Text = "Hello async from the client! " + i }; bus.Request <TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => Console.Out.WriteLine("response = {0}", response.Text)); } Thread.Sleep(5000); }
public void Should_be_able_to_make_a_request_that_runs_async_on_the_server() { var autoResetEvent = new AutoResetEvent(false); var request = new TestAsyncRequestMessage { Text = "Hello async from the client!" }; Console.Out.WriteLine("Making request"); using (var publishChannel = bus.OpenPublishChannel()) { publishChannel.Request <TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => { Console.Out.WriteLine("response = {0}", response.Text); autoResetEvent.Set(); }); } autoResetEvent.WaitOne(2000); }
public void Should_be_able_to_make_many_async_requests() { for (int i = 0; i < 1000; i++) { var request = new TestAsyncRequestMessage { Text = "Hello async from the client! " + i }; bus.Request<TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => Console.Out.WriteLine("response = {0}", response.Text)); } Thread.Sleep(5000); }
public void Should_be_able_to_make_a_request_that_runs_async_on_the_server() { var request = new TestAsyncRequestMessage {Text = "Hello async from the client!"}; Console.Out.WriteLine("Making request"); bus.Request<TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => Console.Out.WriteLine("response = {0}", response.Text)); Thread.Sleep(2000); }
public void Should_be_able_to_make_many_async_requests() { const int numberOfCalls = 500; var countdownEvent = new CountdownEvent(numberOfCalls); var count = 0; for (int i = 0; i < 1000; i++) { var request = new TestAsyncRequestMessage { Text = "Hello async from the client! " + i }; using (var publishChannel = bus.OpenPublishChannel()) { publishChannel.Request<TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => { Console.Out.WriteLine("response = {0}", response.Text); Interlocked.Increment(ref count); countdownEvent.Signal(); }); } } countdownEvent.Wait(10000); count.ShouldEqual(numberOfCalls); }
public void Should_be_able_to_make_a_request_that_runs_async_on_the_server() { var autoResetEvent = new AutoResetEvent(false); var request = new TestAsyncRequestMessage {Text = "Hello async from the client!"}; Console.Out.WriteLine("Making request"); using (var publishChannel = bus.OpenPublishChannel()) { publishChannel.Request<TestAsyncRequestMessage, TestAsyncResponseMessage>(request, response => { Console.Out.WriteLine("response = {0}", response.Text); autoResetEvent.Set(); }); } autoResetEvent.WaitOne(2000); }