public class Subscription extends SubscriptionBase
| Modifier and Type | Class and Description |
|---|---|
class |
Subscription.PublishTask
A task for publishing the data change notifications.
|
items, lifetimeCount, maxKeepAliveCount, maxNotificationsPerPublish, priority, publishingEnabled, publishingInterval, updateCount| Constructor and Description |
|---|
Subscription(SubscriptionManager subscriptionManager,
UnsignedInteger id,
Boolean publishingEnabled,
Double requestedPublishingInterval,
UnsignedInteger requestedLifetimeCount,
UnsignedInteger requestedMaxKeepAliveCount,
UnsignedInteger maxNotificationsPerPublish,
UnsignedByte priority)
Create a new subscription.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
acknowledge(UnsignedInteger sequenceNumber)
Acknowledge that a notification was received by the client.
|
MonitoredDataItem |
addDataItem(ServiceContext serviceContext,
NodeId nodeId,
UnsignedInteger attributeId,
NumericRange indexRange,
QualifiedName dataEncoding,
MonitoringMode monitoringMode)
Add a new monitoring item to the subscription.
|
MonitoredDataItem |
addDataItem(ServiceContext serviceContext,
UaNode node,
UnsignedInteger attributeId,
NumericRange indexRange,
QualifiedName dataEncoding,
MonitoringMode monitoringMode)
Add a new monitoring item to the subscription.
|
MonitoredEventItem |
addEventItem(ServiceContext serviceContext,
NodeId nodeId,
EventFilter eventFilter,
EventFilterResult filterResult)
Add a new item to event monitoring.
|
protected void |
addToPublishQueue(long time,
boolean needsKeepAlive,
boolean checkNotifyTransaction) |
void |
beginNotify()
Begins a Notify change operation.
|
void |
close()
Close the subscription.
|
int |
compareTo(SubscriptionBase s) |
protected MonitoredDataItem |
createMonitoredDataItem(ServiceContext serviceContext,
Subscription subscription,
UnsignedInteger monitoredItemId,
NodeId nodeId,
UnsignedInteger attributeId,
NumericRange indexRange,
MonitoringMode monitoringMode)
This can be overridden to use a subtyped
MonitoredDataItem in a subtyped
Subscription. |
protected MonitoredEventItem |
createMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
UnsignedInteger monitoredItemId,
NodeId nodeId,
EventFilter eventFilter,
EventFilterResult filterResult)
This can be overridden to use a subtyped
MonitoredEventItem in a subtyped
Subscription. |
protected void |
enabledChanged()
Handles a change in PublishingEnabled.
|
void |
endNotify()
Ends a "Notify transaction" started with
beginNotify()). |
boolean |
equals(Object obj) |
UnsignedInteger[] |
getAvailableSequenceNumbers() |
SubscriptionDiagnostics |
getDiagnostics() |
MonitoredItem |
getItem(NodeId nodeId,
UnsignedInteger attributeId)
Find the item that is listening to the specified node attribute.
|
int |
getMaxNotificationsPerPublish()
The maximum number of notifications that the Client wishes to receive in a single Publish
response.
|
protected NotificationMessage |
getNextNotificationMessage(Session session) |
protected UnsignedInteger |
getNextSequenceNumber(boolean isKeepAliveMessage) |
protected NotificationMessage |
getNotificationMessage(UnsignedInteger retransmitSequenceNumber) |
protected BlockingQueue<SubscriptionBase> |
getPublishQueue() |
Session |
getSession() |
SubscriptionManager |
getSubscriptionManager() |
boolean |
hasExpired() |
int |
hashCode() |
Boolean |
hasMoreNotifications() |
protected void |
incrementOverflowCount() |
protected void |
internalClose(boolean removeFromQueue)
Close the subscription.
|
protected void |
internalRemoveItem(MonitoredItem item)
The actual method that will remove the item from the Subscription.
|
boolean |
isClosed() |
protected boolean |
isTimeToPublish(long now) |
protected void |
monitoringModeChanged(MonitoredItem monitoredItem) |
protected void |
needTrigger(MonitoredItem triggeringItem,
boolean isDataChange,
boolean isEventChange) |
protected void |
newEventAvailable(MonitoredEventItem monitoredEventItem) |
protected void |
newSampleAvailable(MonitoredItem monitoredItem) |
protected void |
paramChanged()
Parameter change "event".
|
MonitoredItemBase |
removeItem(MonitoredItemBase item)
Remove an item from the subscription.
|
MonitoredItemBase |
removeItem(UnsignedInteger itemId)
Remove an item from the subscription.
|
protected void |
resetKeepAliveCounter() |
protected void |
resetLastAliveTime() |
protected void |
setPublishQueue(BlockingQueue<SubscriptionBase> queue,
boolean sendInitialValues) |
protected static void |
setPublishTimeCheckAllowedThresholdMS(int value)
Set allowed threshold for publish checks.
|
protected void |
setSession(Session session) |
void |
start()
Close the subscription.
|
protected void |
startPublishing()
Starts the publish timer.
|
protected void |
stopPublishing()
Stops the publish timer.
|
protected void |
updateDiagnostics() |
addItem, applyUpdates, beginUpdate, endUpdate, getItem, getItem, getItemCount, getItems, getLifetimeCount, getMaxKeepAliveCount, getPriority, getPublishingInterval, getSubscriptionId, getUserData, hasItem, hasItem, hasItem, isPublishingEnabled, setLifetimeCount, setLifetimeCount, setMaxKeepAliveCount, setMaxKeepAliveCount, setMaxNotificationsPerPublish, setMaxNotificationsPerPublish, setPriority, setPriority, setPublishingEnabled, setPublishingInterval, setPublishingInterval, setSubscriptionId, setUserData, toStringpublic Subscription(SubscriptionManager subscriptionManager, UnsignedInteger id, Boolean publishingEnabled, Double requestedPublishingInterval, UnsignedInteger requestedLifetimeCount, UnsignedInteger requestedMaxKeepAliveCount, UnsignedInteger maxNotificationsPerPublish, UnsignedByte priority)
publishingEnabled - requestedPublishingInterval - requestedLifetimeCount - requestedMaxKeepAliveCount - maxNotificationsPerPublish - priority - protected static void setPublishTimeCheckAllowedThresholdMS(int value)
value - public MonitoredDataItem addDataItem(ServiceContext serviceContext, NodeId nodeId, UnsignedInteger attributeId, NumericRange indexRange, QualifiedName dataEncoding, MonitoringMode monitoringMode)
nodeId - dataEncoding - indexRange - attributeId - monitoringMode - serviceContext - public MonitoredDataItem addDataItem(ServiceContext serviceContext, UaNode node, UnsignedInteger attributeId, NumericRange indexRange, QualifiedName dataEncoding, MonitoringMode monitoringMode)
node - dataEncoding - indexRange - attributeId - monitoringMode - public MonitoredEventItem addEventItem(ServiceContext serviceContext, NodeId nodeId, EventFilter eventFilter, EventFilterResult filterResult) throws StatusException
nodeId - the node to monitordataEncoding - eventFilter - the event filter definition.filterResult - StatusExceptionpublic void beginNotify()
endNotify() is called (or
equivalent number of, in case of nested beginNotify() calls). Note that this is a
best-effort "transaction", if it last e.g. long enough that a KeepAlive must be sent, it is
ignored.
NOTE! In general this is advanced functionality. One use-case could be if multiple
MonitoredDataItem.notifyDataChange(DataValue) should be "synchronized" to the same
PublishResponse.
public void close()
throws ServiceException
ServiceException - if the SubscriptionManager throws the exceptionpublic int compareTo(SubscriptionBase s)
compareTo in interface Comparable<SubscriptionBase>compareTo in class SubscriptionBasepublic void endNotify()
beginNotify()).public UnsignedInteger[] getAvailableSequenceNumbers()
public SubscriptionDiagnostics getDiagnostics()
public MonitoredItem getItem(NodeId nodeId, UnsignedInteger attributeId)
SubscriptionBasegetItem in class SubscriptionBasenodeId - the listened nodeattributeId - the attributepublic int getMaxNotificationsPerPublish()
SubscriptionBasegetMaxNotificationsPerPublish in class SubscriptionBaseSubscriptionBase.setMaxNotificationsPerPublish(long)public Session getSession()
public SubscriptionManager getSubscriptionManager()
public boolean hasExpired()
public Boolean hasMoreNotifications()
public boolean isClosed()
public MonitoredItemBase removeItem(MonitoredItemBase item) throws ServiceException, StatusException
SubscriptionBaseremoveItem in class SubscriptionBaseitem - The item to remove.ServiceException - if the (possible) service call to delete the item from the server
fails.StatusException - if the subscription does not contain the itempublic MonitoredItemBase removeItem(UnsignedInteger itemId) throws ServiceException, StatusException
SubscriptionBaseremoveItem in class SubscriptionBaseitemId - The ID of the item to remove. In the client side this should be the ClientHandle,
but on server side, the MonitoredItemId is used.ServiceException - if the service call to delete the item from the server fails.StatusException - if the delete response from the server is badpublic void start()
protected void acknowledge(UnsignedInteger sequenceNumber) throws ServiceException
sequenceNumber - the message to acknowledgeServiceException - Bad_SequenceNumberUnknown if the seuqnceNumber is not recognizedprotected void addToPublishQueue(long time,
boolean needsKeepAlive,
boolean checkNotifyTransaction)
time - protected MonitoredDataItem createMonitoredDataItem(ServiceContext serviceContext, Subscription subscription, UnsignedInteger monitoredItemId, NodeId nodeId, UnsignedInteger attributeId, NumericRange indexRange, MonitoringMode monitoringMode)
MonitoredDataItem in a subtyped
Subscription.protected MonitoredEventItem createMonitoredEventItem(ServiceContext serviceContext, Subscription subscription, UnsignedInteger monitoredItemId, NodeId nodeId, EventFilter eventFilter, EventFilterResult filterResult) throws StatusException
MonitoredEventItem in a subtyped
Subscription.StatusExceptionprotected void enabledChanged()
throws ServiceException
enabledChanged in class SubscriptionBaseServiceExceptionprotected NotificationMessage getNextNotificationMessage(Session session)
ServiceExceptionprotected UnsignedInteger getNextSequenceNumber(boolean isKeepAliveMessage)
protected NotificationMessage getNotificationMessage(UnsignedInteger retransmitSequenceNumber) throws ServiceException
retransmitSequenceNumber - StatusExceptionServiceExceptionprotected BlockingQueue<SubscriptionBase> getPublishQueue()
protected void incrementOverflowCount()
protected void internalClose(boolean removeFromQueue)
protected void internalRemoveItem(MonitoredItem item) throws ServiceException, StatusException
item - StatusExceptionServiceExceptionprotected boolean isTimeToPublish(long now)
protected void monitoringModeChanged(MonitoredItem monitoredItem)
protected void needTrigger(MonitoredItem triggeringItem, boolean isDataChange, boolean isEventChange)
protected void newEventAvailable(MonitoredEventItem monitoredEventItem)
monitoredEventItem - protected void newSampleAvailable(MonitoredItem monitoredItem)
monitoredItem - value - protected void paramChanged()
throws ServiceException
paramChanged in class SubscriptionBaseServiceExceptionprotected void resetKeepAliveCounter()
protected void resetLastAliveTime()
protected void setPublishQueue(BlockingQueue<SubscriptionBase> queue, boolean sendInitialValues)
queue - the publishQueue to setsendInitialValues - protected void setSession(Session session)
session - protected void startPublishing()
protected void stopPublishing()
protected void updateDiagnostics()
Copyright © 2026. All rights reserved.