Example #1
0
        /// <summary>
        ///
        /// </summary>
        //public static redisHelper _redisCachqManager = new redisHelper();

        /// <summary>
        /// 监听事件
        /// </summary>
        /// <param name="event"></param>
        /// <returns></returns>
        public Task OnEvent(Nacos.V2.IEvent @event)
        {
            if (@event is Nacos.V2.Naming.Event.InstancesChangeEvent e)
            {
                Console.WriteLine($"==========收到服务变更事件=======》{Newtonsoft.Json.JsonConvert.SerializeObject(e)}");

                // 配置有变动后 刷新redis配置 刷新 mq配置

                //_redisCachqManager.DisposeRedisConnection();
            }

            return Task.CompletedTask;
        }
        /// <summary>
        ///
        /// </summary>
        //public static redisHelper _redisCachqManager = new redisHelper();

        /// <summary>
        /// 监听事件
        /// </summary>
        /// <param name="event"></param>
        /// <returns></returns>
        public Task OnEvent(Nacos.V2.IEvent @event)
        {
            if (@event is Nacos.V2.Naming.Event.InstancesChangeEvent e)
            {
                Console.WriteLine($"==========收到服务变更事件=======》{Newtonsoft.Json.JsonConvert.SerializeObject(e)}");

                // 配置有变动后 刷新redis配置 刷新 mq配置

                //_redisCachqManager.DisposeRedisConnection();


                Serilog.Log.Information($"收到服务变更事件!!! {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}  [{e}]");
            }

            return(Task.CompletedTask);
        }