/// <summary> /// Called when [process requests completed]. /// </summary> /// <param name="processRequestsAsyncCompletedArgs">The process requests async completed args.</param> /// <param name="responseReciever">The response reciever.</param> /// <param name="tempResponseArray">The temp response array.</param> /// <param name="requestsToSendAsArray">The requests to send as array.</param> public override void OnProcessRequestsCompleted( ProcessRequestsAsyncCompletedArgs processRequestsAsyncCompletedArgs, ResponseReceiver responseReciever, Response[] tempResponseArray, Request[] requestsToSendAsArray) { base.OnProcessRequestsCompleted(processRequestsAsyncCompletedArgs, responseReciever, tempResponseArray, requestsToSendAsArray); var requestEndTime = DateTime.Now; var timespan = requestEndTime - _requestStartTime; var requestString = GetRequestString(requestsToSendAsArray); Logger.Debug( "Response received for the following agatha batch: [{0}]. Elapsed milliseconds ({1})", requestString, timespan.TotalMilliseconds); }
protected override void Act() { lastProcessRequestInput = input; lastProcessRequestsThrewException = false; output = null; input.Stub(input.requestResponsePair); asyncRequestProcessor.ProcessRequestsAsync(input.requestResponsePair.Item1, args => output = args); // this uglyness is only here because of the async stuff int counter = 0; while (output == null) { if (++counter == 20) { throw new InvalidOperationException("time out... the callback should've been called already"); } Thread.Sleep(10); } }