node.jsopcopc-uanode-opcua

How to use node-opcua Subscription priority?


The Client subscription in node-opcua has an option called priority. It is a numerical field. I'm not able to understand whether subscription with Priotity=1 will get higher priority than Priority=10 or lower.

The default priority in source code is 1. So it is the lowest, or the highest? Which one will get preference, 1 or 10 or 100?


Solution

  • This is a quote from the specification (v1.03 Part 4. Table 86)

    Indicates the relative priority of the Subscription. When more than one Subscription needs to send Notifications, the Server should dequeue a Publish request to the Subscription with the highest priority number (the bigger the number, the higher the priority). For Subscriptions with equal priority the Server should dequeue Publish requests in a round-robin fashion. When the keep-alive period expires for a Subscription it shall take precedence regardless of its priority, in order to prevent the Subscription from expiring.

    A Client that does not require special priority settings should set this value to zero.

    I don't have very much experience how the servers actually support the priority in practice. It should play a role only when the server has a lot of data changes to be queued at the same time. For most cases you can ignore the parameter.

    EDIT: The specifications are available from https://opcfoundation.org/developer-tools/specifications-unified-architecture (you will just need to register to the OPC Foundation web site to download them)

    EDIT: The specifications for 1.04 are also available online now and the specific page that describe the priority parameter is https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.2/