Beispiel #1
0
        public HttpGateway()
        {
            HttpGatewayConfig Config = BXM.Utils.XmlSerialize.DeSerialize <HttpGatewayConfig>("HttpGatewayConfig");

            this.Gateway = (HttpGatewayInterface)Assembly.GetExecutingAssembly().CreateInstance("HttpGateways." + Config.GatewayClass, true);

            if (Gateway.Config.StatusReportInterval > 0)
            {
                tmrReport          = new Timer(Gateway.Config.StatusReportInterval);
                tmrReport.Elapsed += tmrReport_Elapsed;
            }

            if (Gateway.Config.MOInterval > 0)
            {
                tmrMO          = new Timer(Gateway.Config.MOInterval);
                tmrMO.Elapsed += tmrMO_Elapsed;
            }

            sends = new Dictionary <string, ReportEventArgs>();
            try
            {
                BinarySerialize <Dictionary <string, ReportEventArgs> > bs = new BinarySerialize <Dictionary <string, ReportEventArgs> >();
                sends = bs.DeSerialize("ReportCache");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                LogClient.LogHelper.LogInfo(Gateway.Config.GatewayName, "Save ReportCache Error ->", ex.Message);
            }
        }
Beispiel #2
0
        public HttpPushGateway(string GatewayName)
        {
            HttpGatewayConfig Config = SMS.Util.XmlSerialize.DeSerialize <HttpGatewayConfig>(GatewayName + ".config");

            this.Gateway        = (HttpGatewayInterface)Assembly.GetExecutingAssembly().CreateInstance("HttpGateways." + Config.GatewayClass, true);
            this.Gateway.Config = Config;
            if (Gateway.Config.StatusReportInterval > 0)
            {
                //启动状态报告MQ监听
                SRMQ.Start(this);
            }

            if (Gateway.Config.MOInterval > 0)
            {
                //启动上行短信MQ监听
            }

            sends = new Dictionary <string, ReportEventArgs>();
            try
            {
                BinarySerialize <Dictionary <string, ReportEventArgs> > bs = new BinarySerialize <Dictionary <string, ReportEventArgs> >();
                sends = bs.DeSerialize("ReportCache");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                LogClient.LogHelper.LogInfo(Gateway.Config.GatewayName, "Save ReportCache Error ->", ex.Message);
            }
            if (Config.EnableTrafficControl > 0)
            {
                tc.IntervalMicroSeconds = Config.TrafficMonitorIntervalSeconds * 1000;
                tc.MaxCount             = Config.HandlingAbility * Config.TrafficMonitorIntervalSeconds;
                tc.Start();
            }
        }