Ejemplo n.º 1
0
 void InitOptions()
 {
     if (_options.UseConsul)
     {
         updateSerivceStatus();
         threadWork = new Core.ThreadWork();
         threadWork.Start("consulServiceCheck", () =>
         {
             if (firstCheck)
             {
                 firstCheck = false;
                 return(true);
             }
             updateSerivceStatus();
             return(true);
         }, 10);
     }
     else
     {
         var address = $"{_options.Host}:{_options.Port}";
         channelCache.TryAdd("1", new ChannelObj()
         {
             channel = CreateChannel(address)
         });
     }
 }
Ejemplo n.º 2
0
        public override void Subscribe(EventDeclare eventDeclare)
        {
            var ed = eventDeclare;

            if (ed.IsCopy)
            {
                return;
            }
            var thread = new Core.ThreadWork()
            {
                Args = ed
            };

            thread.Start(ed.Name, SubscribeData, ed.ThreadSleepSecond);
            threads.Add(thread);
        }
Ejemplo n.º 3
0
        public override void SubscribeAsync(EventDeclare eventDeclare)
        {
            var ed = eventDeclare;

            if (ed.IsCopy)
            {
                return;
            }
            var thread = new Core.ThreadWork()
            {
                Args = ed
            };

            thread.Start(ed.Name, (args) =>
            {
                SubscribeDataSync(args).Wait();
                return(true);
            }, ed.ThreadSleepSecond);
            threads.Add(thread);
        }