Method StartStateMonitor
- Namespace
- Skyline.DataMiner.Core.DataMinerSystem.Common
- Assembly
- Skyline.DataMiner.Core.DataMinerSystem.Common.dll
StartStateMonitor(string, Action<ServiceStateChange>, TimeSpan)
Starts monitoring state changes for a specific service. Every change triggers the specified onChange action.
public void StartStateMonitor(string sourceId, Action<ServiceStateChange> onChange, TimeSpan subscribeTimeout)
Parameters
sourceIdstringA unique identifier for the subscription source (e.g., GUID).
onChangeAction<ServiceStateChange>Action to be executed when a state change occurs.
subscribeTimeoutTimeSpanTime limit to establish the subscription.
Remarks
For use outside of Protocols. Use the SLProtocol-based version inside Protocols for proper subscription handling.
Exceptions
- ArgumentNullException
sourceIdoronChangeis null.- InvalidOperationException
Subscription setup failed within the specified timeout.
StartStateMonitor(string, Action<ServiceStateChange>)
Starts monitoring service state changes using the default timeout.
public void StartStateMonitor(string sourceId, Action<ServiceStateChange> onChange)
Parameters
sourceIdstringUnique string that identifies the source of the subscription.
onChangeAction<ServiceStateChange>Callback executed on every state change event.
Remarks
Intended for non-Protocol use only. For Protocols, use the overload with SLProtocol.
Exceptions
- ArgumentNullException
sourceIdoronChangeis null.- InvalidOperationException
Subscription could not be initialized in the default time frame.