public void ProcessRequest(RequestBase request, HandlerResponse response) { PingHandlerRequest pingRequest = request as PingHandlerRequest; response.Status = RequestStatusEnum.InProgress; _Context.Cache.SaveObject <HandlerResponse>(response); // sleep if required if (pingRequest.DelayPeriod != null) { _Context.Logger.LogDebug("PingHandlerRequest: Sleeping for {0}", pingRequest.DelayPeriod); Thread.Sleep(TimeSpan.Parse(pingRequest.DelayPeriod)); _Context.Logger.LogDebug("PingHandlerRequest: Sleep complete."); } // throw error if required if (pingRequest.FaultMessage != null) { throw new Exception(pingRequest.FaultMessage); } response.Status = RequestStatusEnum.Completed; _Context.Cache.SaveObject <HandlerResponse>(response); }
private void btnGenPingRequest_Click(object sender, EventArgs e) { Guid requestId = Guid.NewGuid(); PingHandlerRequest request = new PingHandlerRequest() { RequestId = requestId.ToString(), RequestDescription = String.Format("Test Ping"), RequesterId = new UserIdentity() { Name = _ClientRef.Target.ClientInfo.Name, DisplayName = "Grid Test Harness" }, SubmitTime = DateTimeOffset.Now.ToString("o"), DelayPeriod = TimeSpan.FromSeconds(Convert.ToDouble(nudPingDelay.Value)).ToString(), FaultMessage = chkPingFault.Checked ? "Test Fault" : null }; _ClientRef.Target.SaveObject <PingHandlerRequest>(request); // save request for execution txtRequestId.Text = requestId.ToString(); _Request = request; }