Exemple #1
0
        public bool HanderMessage(TinctMessage message)
        {
            try
            {
                var deploycontent = DeployContent.GetObjectBySerializeString(message.MessageBody);
                if (deploycontent.FileName == null)
                {
                    return(true);
                }

                foreach (var appdomain in ExcuteEnvironment.Current.AppDomainDicts)
                {
                    try
                    {
                        AppDomain.Unload(appdomain.Value);
                    }
                    catch
                    {
                    }
                }
                ExcuteEnvironment.Current.AppDomainDicts.Clear();

                try
                {
                    File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "//" + deploycontent.FileName, deploycontent.Content);
                    deploycontent.Status = "Completed";
                }
                catch
                {
                    deploycontent.Status = "Failed";
                    TinctSlaveNode.Current.NodeInfo.Status = NodeStatus.DeployFailed;
                }
                // deploycontent.TargetNodeName =Dns.GetHostName();

                //TinctSlaveNode.Current.(TinctSlaveNode.Current.NodeInfo.ToJsonSerializeString(), masterName);
                //TinctSlaveNode.Current.SendMessageToMaster(deploycontent.ToJsonSerializeString(), masterName);
            }
            catch
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        public bool HanderMessage(TinctMessage message)
        {
            var deploycontent = DeployContent.GetObjectBySerializeString(message.MessageBody);

            if (deploycontent.FileName == null)
            {
                return(true);
            }
            else
            {
                var node = NodeRepository.Current.NodeInfoList.FirstOrDefault(t => t.NodeName == deploycontent.TargetNodeName);
                if (deploycontent.Status == "Failed")
                {
                    node.Status = NodeStatus.DeployFailed;
                }
                else
                {
                    node.Status = NodeStatus.Running;
                }
            }

            return(false);
        }