public void OnInstanceRegisted(BahamutAppInstanceNotification state) { try { var set = OnlineAppInstances[state.Appkey]; set.Add(state.InstanceId); } catch (Exception) { var set = new HashSet<string>(); set.Add(state.InstanceId); OnlineAppInstances[state.Appkey] = set; } AppInstancesExpire[state.InstanceId] = DateTime.UtcNow; #if DEBUG if (state.NotifyType == BahamutAppInstanceNotification.TYPE_REGIST_APP_INSTANCE) { Console.WriteLine("{0} Instance Online:{1}", GetAppChannelId(state.Appkey), state.InstanceId); } else if (state.NotifyType == BahamutAppInstanceNotification.TYPE_INSTANCE_HEART_BEAT) { Console.WriteLine("{0} Instance Heart Beat:{1}", GetAppChannelId(state.Appkey), state.InstanceId); } #endif }
public void OnInstanceOffline(BahamutAppInstanceNotification state) { try { OnlineAppInstances[state.Appkey].Remove(state.InstanceId); AppInstancesExpire.Remove(state.InstanceId); } catch (Exception) { } }
public void OnInstanceHeartBeating(BahamutAppInstanceNotification state) { OnInstanceRegisted(state); }