QuickOPC User's Guide and Reference
PullDataChangeNotificationQueueCapacity Property (EasyUAClient)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace > EasyUAClient Class : PullDataChangeNotificationQueueCapacity Property
Capacity of the event pull queue for data change notifications.
Syntax
'Declaration
 
<DefaultValueAttribute(0)>
Public Property PullDataChangeNotificationQueueCapacity As Integer
'Usage
 
Dim instance As EasyUAClient
Dim value As Integer
 
instance.PullDataChangeNotificationQueueCapacity = value
 
value = instance.PullDataChangeNotificationQueueCapacity
[DefaultValue(0)]
public int PullDataChangeNotificationQueueCapacity {get; set;}
[DefaultValue(0)]
public:
property int PullDataChangeNotificationQueueCapacity {
   int get();
   void set (    int value);
}
Remarks

This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.

Example
// This example shows how to subscribe to changes of a single monitored item, pull events, and display each change.

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    class PullDataChangeNotification
    {
        public static void Main1()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            // Instantiate the client object
            // In order to use event pull, you must set a non-zero queue capacity upfront.
            var client = new EasyUAClient { PullDataChangeNotificationQueueCapacity = 1000 };

            Console.WriteLine("Subscribing...");
            client.SubscribeDataChange(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", 1000);

            Console.WriteLine("Processing data change events for 1 minute...");
            int endTick = Environment.TickCount + 60 * 1000;
            do
            {
                EasyUADataChangeNotificationEventArgs eventArgs = client.PullDataChangeNotification(2 * 1000);
                if (!(eventArgs is null))
                    // Handle the notification event
                    Console.WriteLine(eventArgs);
            } while (Environment.TickCount < endTick);

            Console.WriteLine("Unsubscribing...");
            client.UnsubscribeAllMonitoredItems();
        }
    }
}
# This example shows how to subscribe to changes of a single monitored item, pull events, and display each change.

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA

# The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows .
Add-Type -Path "../../../Components/net472/OpcLabs.EasyOpcUA.dll"

[UAEndpointDescriptor]$endpointDescriptor =
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
# or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
# or "https://opcua.demo-this.com:51212/UA/SampleServer/"

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

Write-Host "Subscribing..."
$client.SubscribeDataChange($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", 1000)

Write-Host "Processing data change events for 1 minute..."
$stopwatch =  [System.Diagnostics.Stopwatch]::StartNew() 
while ($stopwatch.Elapsed.TotalSeconds -lt 60) {    
    $eventArgs = $client.PullDataChangeNotification(2*1000)
    if ($eventArgs -ne $null) {
        # Handle the notification event
        Write-Host $eventArgs
    }
}

Write-Host "Unsubscribing..."
$client.UnsubscribeAllMonitoredItems()

Write-Host "Finished."
Rem This example shows how to subscribe to changes of a single monitored item, pull events, and display each change.

Public Sub PullDataChangeNotification_Main_Command_Click()
    OutputText = ""
    
    Dim eventArgs As EasyUADataChangeNotificationEventArgs
    
    ' Instantiate the client object
    Dim Client As New EasyUAClient
    
    ' In order to use event pull, you must set a non-zero queue capacity upfront.
    Client.PullDataChangeNotificationQueueCapacity = 1000
    
    OutputText = OutputText & "Subscribing..." & vbCrLf
    Call Client.SubscribeDataChange("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10853", 1000)

    OutputText = OutputText & "Processing data changed notification events for 1 minute..." & vbCrLf
    
    Dim EndTick As Long
    EndTick = GetTickCount + 60000
    While GetTickCount < EndTick
        Set eventArgs = Client.PullDataChangeNotification(2 * 1000)
        If Not eventArgs Is Nothing Then
            ' Handle the notification event
            OutputText = OutputText & eventArgs & vbCrLf
        End If
    Wend
    
    OutputText = OutputText & "Unsubscribing..." & vbCrLf
    Client.UnsubscribeAllMonitoredItems

    OutputText = OutputText & "Finished." & vbCrLf
End Sub
' This example shows how to subscribe to changes of a single monitored item, pull events, and display each change.

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Friend Class PullDataChangeNotification
        Public Shared Sub Main1()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

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

            Console.WriteLine("Subscribing...")
            client.SubscribeDataChange(
                endpointDescriptor,
                "nsu=http://test.org/UA/Data/ ;i=10853",
                1000)   ' or "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

            Console.WriteLine("Processing data change events for 1 minute...")
            Dim endTick As Integer = Environment.TickCount + 60 * 1000
            Do
                Dim eventArgs As EasyUADataChangeNotificationEventArgs = client.PullDataChangeNotification(2 * 1000)
                If Not eventArgs Is Nothing Then
                    ' Handle the notification event
                    Console.WriteLine(eventArgs)
                End If
            Loop While Environment.TickCount < endTick
        End Sub
    End Class
End Namespace
Requirements

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

See Also