示例#1
0
 protected MethodReturnMessage RemoteCall(MethodCallMessage call)
 {
     try
     {
         return(_requestor.MakeRequest(call));
     }
     catch (IOException e)
     {
         throw new RemoteCallException("remote method call failed becuase of communication error", e);
     }
 }
示例#2
0
文件: ToyNS.cs 项目: axnsan12/toyorb
        public static void RegisterAndStart(string serviceName, IToyOrbService serviceImpl, string nsHost = DefaultHostname, int nsPort = DefaultPort)
        {
            ServerSideProxy serviceProxy = BindAvailablePort(serviceName, serviceImpl);

            var request   = new ServiceRegistrationMessage(serviceName, serviceImpl.ServiceType, serviceProxy.Port);
            var requestor = new Requestor <ServiceRegistrationMessage, NameResponseMessage>(nsHost, nsPort);
            NameResponseMessage response = requestor.MakeRequest(request);

            response.Check();

            serviceProxy.Start();
        }
示例#3
0
        /// <summary>
        /// Logs an error Amazons Queing Service
        /// </summary>
        public override string Log(Error error)
        {
            string id = string.Empty;
            bool EnableSQSLogging = false;

            try
            {
                EnableSQSLogging = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSQSLogging"]);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            if (EnableSQSLogging)
            {
                if (error == null)
                    throw new ArgumentNullException("error");

                try
                {
                    error.ApplicationName = ApplicationName;
                    string errorXml = ErrorXml.EncodeString(error);

                    requestor = new Requestor();

                    requestor.AwsID             = ConfigurationManager.AppSettings["AwsID"];
                    requestor.AWSSecretKey      = ConfigurationManager.AppSettings["AWSSecretKey"];
                    requestor.Queue             = ConfigurationManager.AppSettings["Queue"];

                    id = requestor.MakeRequest(errorXml);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }
            }
            return id;
        }