Connectivity Software User's Guide and Reference
Poll Event (ISparkplugProducerEvents)



OpcLabs.EasySparkplug Assembly > OpcLabs.EasySparkplug Namespace > ISparkplugProducerEvents Interface : Poll Event
Raised to poll for data and return the Sparkplug payload.
Syntax
'Declaration
 
Event Poll As SparkplugProducerPollEventHandler
'Usage
 
Dim instance As ISparkplugProducerEvents
Dim handler As SparkplugProducerPollEventHandler
 
AddHandler instance.Poll, handler
Event Data

The event handler receives an argument of type SparkplugProducerPollEventArgs containing data related to this event. The following SparkplugProducerPollEventArgs properties provide information specific to this event.

PropertyDescription
The device associated with this event, if any. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs)
The edge node associated with this event. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs)
(Inherited from System.ComponentModel.HandledEventArgs)
The name of the metric associated with this event. Empty if the event is not associated with a metric. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs)
The payload that is the result of the Sparkplug poll.  
Remarks

Handle this event to implement custom code that polls for the data and creates the payload be to be published.

If the event is handled (its System.ComponentModel.HandledEventArgs.Handled property is set to true), your code is expected to collect the data for publishing itself, providing the whole payload at once, in the event result (OpcLabs.EasySparkplug.OperationModel.SparkplugProducerPollEventArgs.Result). The component will then send the payload out (if there is anything to publish), by internally calling the PublishDataPayload method. The individual metrics will not be polled (read) by the component.

If the event is not handled (its System.ComponentModel.HandledEventArgs.Handled property remains at false), the component will poll (read) the individual metrics, and then publish the data that has changed. This is done in following steps:

  1. The publishing is locked (LockPublishing). This means that data changes in individual metrics will not be immediately published.
  2. Metrics that are readable and pollable are polled (SparkplugMetric.PerformPoll).
  3. The publishing is unlocked (UnlockPublishing). At this point, if any of the polled metrics data has changed, the component will assemble the payload consisting of the changed data, and publish it.

Instead of adding an event handler to this event, you can use the ISparkplugProducerExtension.PollFunction method and specify the function that polls for the data and returns the payload to be published.

 

Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also