Beispiel #1
0
        // 主站调用 Dongmin 20191005
        public void OnDataSyncToPartner(object sender)
        {
            //夏 2019年8月22日 17:46:53  判断host是否为null
            if (_host == null)
            {
                return;
            }

            // David 20191005
            if (!PartnerAlive)
            {
                return;
            }

            PartnerProxy _proxy = (PartnerProxy)_host.GetProxy();

            if (_proxy != null)
            {
                //_proxy.ExchangeData("testresource","testdata"); //测试

                foreach (IResource resource in ResourceManager.GetAllResources())
                {
                    if (resource is IRedundancy)
                    {
                        IRedundancy res = (IRedundancy)resource;

                        if (res.NeedDataSync)
                        {
                            string dataToSend = res.BuildSyncData();

                            //LOG.Debug(string.Format("RedundancyServer:向从站同步数据 resource:{0},data:{1}", resource.ResourceName, dataToSend));
                            _proxy.ExchangeData(resource.ResourceName, dataToSend);
                        }
                    }
                }
            }
        }