.NET Based OPC UA Client/Server SDK  3.3.3.537
Manage Subscription – Modify Subscription

Prerequisites

A session and a subscription with the server must be established.

Description

The following dialog shows an example dialog to modify an existing subscription. Press the button “Show Code” to display the corresponding code, and the button “Help” to show this documentation page.

clienttutorials_modify_subscription.png

At startup, the input fields in the column “Requested Parameters” are filled out with the current subscription parameters. Edit the values you would like to change, check or uncheck the box next to “Publishing Enabled” and press the button “Modify”. The new subscription parameters set by the server are now displayed in the column “Revised Parameters”. Check the box in front of “Use Asynchronous Pattern” to call “BeginModify” instead of “Modify”.

Sample Code

The following code modifies an existing subscription according to the specified parameters and displays the revised parameters in the user interface.

The requested and reviced settings of the Subscrition are used in the same way as described in Manage Subscription – Create Subscription. UaClient.Subscription.Modify will update the subscription settings on server side.

// initialize subscription.
m_subscription.PublishingInterval = (double)PublishingIntervalUD.Value;
m_subscription.MaxKeepAliveTime = (double)KeepAliveTimeUD.Value;
m_subscription.Lifetime = (double)LifeTimeUD.Value;
m_subscription.MaxNotificationsPerPublish = (uint)MaxNotificationsUD.Value;
m_subscription.Priority = (byte)PriorityUD.Value;
m_subscription.PublishingEnabled = PublishingEnabledCK.Checked;
// modify subscription.
m_subscription.Modify(new RequestSettings() { OperationTimeout = 10000 });
// update controls.
CurrentPublishingIntervalTB.Text = m_subscription.CurrentPublishingInterval.ToString();
CurrentKeepAliveTimeTB.Text = m_subscription.CurrentMaxKeepAliveTime.ToString();
CurrentLifeTimeTB.Text = m_subscription.CurrentLifetime.ToString();
CurrentMaxNotificationsTB.Text = m_subscription.CurrentMaxNotificationsPerPublish.ToString();
CurrentPriorityTB.Text = m_subscription.CurrentPriority.ToString();
CurrentPublishingEnabledCK.Checked = m_subscription.CurrentPublishingEnabled;