AFDataPipe.Subscribe Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Register an IObserver for AFDataPipeEvent with the AFDataPipe. All the AFDataPipeEvents
received by the data pipe will be sent to the IObserver.
Namespace: OSIsoft.AF.Data
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public IDisposable Subscribe( IObserver<AFDataPipeEvent> observer )
Public Function Subscribe ( observer As IObserver(Of AFDataPipeEvent) ) As IDisposable Dim instance As AFDataPipe Dim observer As IObserver(Of AFDataPipeEvent) Dim returnValue As IDisposable returnValue = instance.Subscribe(observer)
public: IDisposable^ Subscribe( IObserver<AFDataPipeEvent^>^ observer )
member Subscribe : observer : IObserver<AFDataPipeEvent> -> IDisposable
Parameters
- observer
- Type: SystemIObserverAFDataPipeEvent
The object that is to receive AFDataPipeEvents.
Return Value
Type: IDisposablean IDispoable interface for the object to unsubscribe itself from the data pipe.
Remarks
The method will throw exception if the passed observer is null.
Also, unlike IObservable, the data pipe will need the application to trigger pulling of events, it does not
completely operate on push mechanism. Application has to call the GetObserverEvents method
to start the event notification to the IObserver.
Once the application registers an IObserver to the data pipe, the data pipe will not allow the application
to get data with the GetUpdateEvents methods. All subsequent events will be passed through the
IObservers to the application, triggering by the GetObserverEvents method.