Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            using (bus = new Bus(@".\private$\testreq", @".\private$\", @".\private$\testack", null, null, null))
            {
                Console.WriteLine("Sending...");

                var atoken = bus.Async<ARequest, AResponse>(new ARequest());
                var btoken = bus.Async<BRequest, BResponse>(new BRequest());
                var ctoken = bus.Async<CRequest, CResponse>(new CRequest());
                var dtoken = bus.Async<DRequest, DResponse>(new DRequest());

                Console.WriteLine("All Sent");

                Console.WriteLine("Waiting");

                while (true)
                {
                    if (
                        !bus.IsReady<AResponse>(atoken) ||
                        !bus.IsReady<BResponse>(btoken) ||
                        !bus.IsReady<CResponse>(ctoken) ||
                        !bus.IsReady<DResponse>(dtoken))
                    {
                        Thread.Sleep(100);
                        Console.WriteLine("Waiting...");
                    }
                }

                var a = bus.GetAsyncResponse<AResponse>(atoken);
                var b = bus.GetAsyncResponse<BResponse>(btoken);
                var c = bus.GetAsyncResponse<CResponse>(ctoken);
                var d = bus.GetAsyncResponse<DResponse>(dtoken);

                Console.WriteLine("Completed.");

                Console.ReadLine();
            }
        }