Ejemplo n.º 1
0
        public static void SendRequest(HTTPRequest_ClientToGateway request)
        {
            using (var bus = RabbitHutch.CreateBus("host=localhost;timeout=5"))
            {
                try
                {
                    MonitorObject = new MonitorObject();
                    MonitorObject.StartMonitoring();
                    request.Cookie = ClientSession.ClientCookie;
                    #region HTTP command setup

                    #endregion
                    var task = bus.RequestAsync <HTTPRequest_ClientToGateway, HTTPRequest_RetailerToClientGateway>(request);

                    // Each response is handled by a separate task.
                    // the requester can have multiple outstanding requests.
                    task.ContinueWith(response => HandleResponse(response)).Wait();
                }
                catch (AggregateException ex)
                {
                    Console.WriteLine("Request to server failed.");
                }
            }
        }