예제 #1
0
        protected ResponseMessage Receive(RequestMessage message)
        {
            TracerHelper.TraceEntry(message.GetType().Name);

            try
            {
                OperationInformation info = new OperationInformation();
                info.Request = message;

                if (message.PerformSynchronous)
                {
                    ResponseMessage result;
                    if (_stub.PerformOperation <ResponseMessage>(info, null, true, out result))
                    {// Operation performed successfully.
                        TracerHelper.Trace("Operation [" + message.GetType().Name + "] performed successfully.");
                        return(result);
                    }
                    else
                    {
                        TracerHelper.TraceOperationError("Operation [" + message.GetType().Name + "] timed out.");
                    }
                }
                else
                {
                    _stub.PlaceOperation(info, true);

                    if (message.RequestResponse)
                    {
                        return(new ResponseMessage(true));
                    }

                    return(null);
                }
            }
            catch (Exception ex)
            {// Make sure we handle any possible unexpected exceptions, as otherwise they bring the
                // entire package (MT4 included) down with a bad error.
                SystemMonitor.Error(ex.Message);
            }

            return(null);
        }
예제 #2
0
 /// <summary>
 /// Submit a dataDelivery retrieval request.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public bool Place(DataHistoryOperation operation)
 {
     return(_operationStub.PlaceOperation(operation, true));
 }