OPC Studio User's Guide and Reference
Examples - OPC Unified Architecture - Event pull, subscribing to multiple data change notifications

.NET

# This example shows how to subscribe to changes of multiple monitored items, pull events, and display each change.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.OperationModel import *


# Instantiate the client object
client = EasyUAClient()
# In order to use event pull, you must set a non-zero queue capacity upfront.
client.PullDataChangeNotificationQueueCapacity = 1000

print('Subscribing...')
client.SubscribeMultipleMonitoredItems([
    EasyUAMonitoredItemArguments(
        None,
        UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'),
        UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10845'),
        UAMonitoringParameters(1000)),
    EasyUAMonitoredItemArguments(
        None,
        UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'),
        UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853'),
        UAMonitoringParameters(1000)),
    EasyUAMonitoredItemArguments(
        None,
        UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'),
        UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10855'),
        UAMonitoringParameters(1000)),
    ])

print('Processing data change events for 1 minute...')
endTime = time.time() + 60
while time.time() < endTime:
    eventArgs = IEasyUAClientExtension.PullDataChangeNotification(client, 2*1000)
    if eventArgs is not None:
        # Handle the notification event
        print(eventArgs)

COM

# This example shows how to subscribe to changes of multiple monitored items, pull events, and display each change.
#
# The Python for Windows (pywin32) extensions package is needed. Install it using "pip install pypiwin32".
# CAUTION: We now recommend using Python.NET package instead. Full set of examples with Python.NET is available!
#
# Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
import time
import win32com.client

# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient') 
# In order to use event pull, you must set a non-zero queue capacity upfront.
client.PullDataChangeNotificationQueueCapacity = 1000

print('Subscribing...')
monitoringParameters = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.UAMonitoringParameters')
monitoringParameters.SamplingInterval = 1000

monitoredItemArguments1 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments1.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments1.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10845'
monitoredItemArguments1.MonitoringParameters = monitoringParameters

monitoredItemArguments2 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments2.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments2.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10853'
monitoredItemArguments2.MonitoringParameters = monitoringParameters

monitoredItemArguments3 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments3.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments3.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10855'
monitoredItemArguments3.MonitoringParameters = monitoringParameters

arguments = [
    monitoredItemArguments1,
    monitoredItemArguments2,
    monitoredItemArguments3
    ]
client.SubscribeMultipleMonitoredItems(arguments)

print('Processing data change events for 1 minute...')
endTime = time.time() + 60
while time.time() < endTime:
    eventArgs = client.PullDataChangeNotification(2*1000)
    if eventArgs is not None:
        # Handle the notification event
        print(eventArgs)
See Also

Conceptual

Examples - OPC Alarms&Events

Examples - OPC UA Alarms&Conditions