Exemple #1
0
 public Object OnRequest(IRequest request)
 {
     if (request != null)
     {
         IResponse response = new ChannelResponse();
         response.RequestId = request.RequestId;
         response.Channel   = request.Channel;
         response.Source    = request.Source;
         try
         {
             response.ResponseMessage = _requestListener.OnRequest(request);
         }
         catch (Exception ex)
         {
             response.Error = new RemoteException(ex);
         }
         try
         {
             if (requestManager != null && !request.NoResponse)
             {
                 requestManager.SendResponse(response);
             }
         }
         catch (ChannelException e)
         {
             if (LoggerManager.Instance.ShardLogger != null &&
                 LoggerManager.Instance.ShardLogger.IsErrorEnabled)
             {
                 LoggerManager.Instance.ShardLogger.Error("Error: Dualchannel.OnRequest()", e.ToString());
             }
         }
     }
     return(null);
 }
Exemple #2
0
 public void Execute()
 {
     if (_requestListener != null)
     {
         _requestListener.OnRequest((IRequest)_message);
     }
 }
Exemple #3
0
 public void Execute()
 {
     try
     {
         if (_requestListener != null)
         {
             _requestListener.OnRequest((IRequest)_message);
         }
     }
     catch (Exception)
     {
     }
 }
Exemple #4
0
            public void ReceiveMessage(IChannelMessage message)
            {
                try
                {
                    IRequest request = message as IRequest;
                    if (request != null)
                    {
                        if (_threadPool != null)
                        {
                            _threadPool.ExecuteTask(new RequestDeliverTask(message, _requestListener));
                        }
                        else
                        {
                            _requestListener.OnRequest(request);
                        }
                    }
                    else
                    {
                        IResponse response = message as IResponse;

                        if (_responseListener != null)
                        {
                            _responseListener.ReceiveMessage(message);
                        }
                        //if(response != null)
                        //    _threadPool.ExecuteTask(new ResponseDeliverTask(message, _responseListener));
                    }
                }
                catch (Exception ex)
                {
                    if (LoggerManager.Instance.ServerLogger != null && LoggerManager.Instance.ServerLogger.IsErrorEnabled)
                    {
                        LoggerManager.Instance.ServerLogger.Error("DualChannelListener.RecieveMessage", ex.Message);
                    }
                }
            }