// Token: 0x06000600 RID: 1536 RVA: 0x00023CB8 File Offset: 0x00021EB8 internal DowntimeMonitoringNotificationSubscriber(INetObjectDowntimeDAL netObjectDowntimeDal, IInformationServiceProxyCreator serviceProxyCreator, ISwisUriParser swisUriParser) { if (netObjectDowntimeDal == null) { throw new ArgumentNullException("netObjectDowntimeDal"); } this._netObjectDowntimeDal = netObjectDowntimeDal; if (serviceProxyCreator == null) { throw new ArgumentNullException("serviceProxyCreator"); } this._swisServiceProxyCreator = serviceProxyCreator; if (swisUriParser == null) { throw new ArgumentNullException("swisUriParser"); } this._swisUriParser = swisUriParser; this._nodeNetObjectIdColumn = null; this._netObjectTypes = new Lazy <ILookup <string, NetObjectTypeEx> >(new Func <ILookup <string, NetObjectTypeEx> >(this.LoadNetObjectTypesExtSwisInfo), LazyThreadSafetyMode.PublicationOnly); }
internal DowntimeMonitoringNotificationSubscriber( INetObjectDowntimeDAL netObjectDowntimeDal, IInformationServiceProxyCreator serviceProxyCreator, ISwisUriParser swisUriParser, ISubscriptionManager subscriptionManager) { INetObjectDowntimeDAL objectDowntimeDal = netObjectDowntimeDal; if (objectDowntimeDal == null) { throw new ArgumentNullException(nameof(netObjectDowntimeDal)); } this._netObjectDowntimeDal = objectDowntimeDal; IInformationServiceProxyCreator serviceProxyCreator1 = serviceProxyCreator; if (serviceProxyCreator1 == null) { throw new ArgumentNullException(nameof(serviceProxyCreator)); } this._swisServiceProxyCreator = serviceProxyCreator1; ISwisUriParser swisUriParser1 = swisUriParser; if (swisUriParser1 == null) { throw new ArgumentNullException(nameof(swisUriParser)); } this._swisUriParser = swisUriParser1; this._nodeNetObjectIdColumn = (string)null; this._netObjectTypes = new Lazy <ILookup <string, NetObjectTypeEx> >(new Func <ILookup <string, NetObjectTypeEx> >(this.LoadNetObjectTypesExtSwisInfo), LazyThreadSafetyMode.PublicationOnly); ISubscriptionManager isubscriptionManager = subscriptionManager; if (isubscriptionManager == null) { throw new ArgumentNullException(nameof(subscriptionManager)); } this._subscriptionManager = isubscriptionManager; }
// Token: 0x060005FF RID: 1535 RVA: 0x00023CA4 File Offset: 0x00021EA4 public DowntimeMonitoringNotificationSubscriber(INetObjectDowntimeDAL netObjectDowntimeDal) : this(netObjectDowntimeDal, SwisConnectionProxyPool.GetSystemCreator(), new SwisUriParser()) { }
public DowntimeMonitoringNotificationSubscriber(INetObjectDowntimeDAL netObjectDowntimeDal) : this(netObjectDowntimeDal, (IInformationServiceProxyCreator)SwisConnectionProxyPool.GetSystemCreator(), (ISwisUriParser) new SwisUriParser(), SubscriptionManager.get_Instance()) { }
public Task OnNotificationAsync(Notification notification) { Stopwatch stopwatch = new Stopwatch(); try { stopwatch.Start(); if (notification.get_SourceInstanceProperties() == null) { throw new ArgumentNullException("sourceInstanceProperties"); } if (DowntimeMonitoringNotificationSubscriber.log.get_IsDebugEnabled()) { DowntimeMonitoringNotificationSubscriber.log.Debug((object)this.DetailInfo(notification.get_SubscriptionId(), notification.get_IndicationType(), notification.get_IndicationProperties(), notification.get_SourceInstanceProperties())); } object obj1 = (object)null; notification.get_SourceInstanceProperties().TryGetValue("InstanceType", out obj1); if (obj1 == null) { notification.get_SourceInstanceProperties().TryGetValue("SourceInstanceType", out obj1); } if (!(obj1 is string instanceType)) { DowntimeMonitoringNotificationSubscriber.log.Error((object)"Wrong PropertyBag data. InstanceType or SourceInstanceType are null"); return(Task.CompletedTask); } string columnForSwisEntity = this.GetNetObjectIdColumnForSwisEntity(instanceType); if (columnForSwisEntity == null) { DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Not a supported instance type: {0}", (object)instanceType); return(Task.CompletedTask); } object obj2; if (!notification.get_SourceInstanceProperties().TryGetValue(columnForSwisEntity, out obj2)) { DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Unable to get Entity ID. InstanceType : {0}, ID Field: {1}", (object)instanceType, (object)columnForSwisEntity); return(Task.CompletedTask); } if (notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)2) || notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)0)) { object statusObject1; notification.get_SourceInstanceProperties().TryGetValue("Status", out statusObject1); if (statusObject1 == null) { DowntimeMonitoringNotificationSubscriber.log.DebugFormat("No Status reported for InstanceType : {0}", (object)instanceType); return(Task.CompletedTask); } if (this._nodeNetObjectIdColumn == null) { this._nodeNetObjectIdColumn = this.GetNetObjectIdColumnForSwisEntity("Orion.Nodes"); } object statusObject2; notification.get_SourceInstanceProperties().TryGetValue(this._nodeNetObjectIdColumn, out statusObject2); if (statusObject2 == null) { DowntimeMonitoringNotificationSubscriber.log.DebugFormat("SourceBag must include NodeId. InstanceType : {0}", (object)instanceType); return(Task.CompletedTask); } INetObjectDowntimeDAL objectDowntimeDal = this._netObjectDowntimeDal; NetObjectDowntime netObjectDowntime = new NetObjectDowntime(); netObjectDowntime.set_EntityID(obj2.ToString()); netObjectDowntime.set_NodeID(this.ExtractStatusID(statusObject2)); netObjectDowntime.set_EntityType(instanceType); netObjectDowntime.set_DateTimeFrom((DateTime)notification.get_IndicationProperties()[(string)IndicationConstants.IndicationTime]); netObjectDowntime.set_StatusID(this.ExtractStatusID(statusObject1)); objectDowntimeDal.Insert(netObjectDowntime); } else if (notification.get_IndicationType() == IndicationHelper.GetIndicationType((IndicationType)1)) { this._netObjectDowntimeDal.DeleteDowntimeObjects(obj2.ToString(), instanceType); } } catch (Exception ex) { DowntimeMonitoringNotificationSubscriber.log.Error((object)string.Format("Exception occured when processing incoming indication of type \"{0}\"", (object)notification.get_IndicationType()), ex); } finally { stopwatch.Stop(); DowntimeMonitoringNotificationSubscriber.log.DebugFormat("Downtime notification has been processed in {0} miliseconds.", (object)stopwatch.ElapsedMilliseconds); } return(Task.CompletedTask); }