public PassthroughResponse ProcessPassthrough(PassthroughRequest objRequest)
 {
     try
     {
         objPassthrough.PassthroughGrid = objclsDashboard.GetPassthroughData(objRequest.DateTime);
         return(objPassthrough);
     }
     catch (Exception)
     {
         return(objPassthrough);
     }
     finally
     {
         objPassthrough  = null;
         objclsDashboard = null;
     }
 }
Пример #2
0
        public void Passthrough(string recipientId, string passthroughName, byte[] dataToSend, out IEnumerable <byte> returnData)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("Cannot access a disposed Context.");
            }

            if (!ServerContextIsOperational)
            {
                throw new InvalidOperationException();
            }

            try
            {
                var passthroughDataToSendFull = new PassthroughData();
                passthroughDataToSendFull.Data = ByteString.CopyFrom(dataToSend);
                returnData = new byte[0];
                foreach (var passthroughDataToSend in passthroughDataToSendFull.SplitForCorrectGrpcMessageSize())
                {
                    var request = new PassthroughRequest
                    {
                        ContextId       = _serverContextId,
                        RecipientId     = recipientId,
                        PassthroughName = passthroughName,
                        DataToSend      = passthroughDataToSend
                    };
                    while (true)
                    {
                        PassthroughReply reply = _resourceManagementClient.Passthrough(request);
                        request.DataToSend = new PassthroughData();
                        SetResourceManagementLastCallUtc();
                        IEnumerable <byte>?returnDataTemp = null;
                        if (!String.IsNullOrEmpty(reply.ReturnData.Guid) && _incompletePassthroughRepliesCollection.Count > 0)
                        {
                            var beginPassthroughReply = _incompletePassthroughRepliesCollection.TryGetValue(reply.ReturnData.Guid);
                            if (beginPassthroughReply is not null)
                            {
                                _incompletePassthroughRepliesCollection.Remove(reply.ReturnData.Guid);
                                returnDataTemp = beginPassthroughReply.Concat(reply.ReturnData.Data);
                            }
                        }
                        if (returnDataTemp is null)
                        {
                            returnDataTemp = reply.ReturnData.Data;
                        }

                        if (!String.IsNullOrEmpty(reply.ReturnData.NextGuid))
                        {
                            _incompletePassthroughRepliesCollection[reply.ReturnData.NextGuid] = returnDataTemp;

                            request = new PassthroughRequest
                            {
                                ContextId = _serverContextId
                            };

                            continue;
                        }

                        returnData = returnDataTemp;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessRemoteMethodCallException(ex);
                throw;
            }
        }