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) }); } }
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); }
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); }