How to configure the opcua-connector-service
The opcua-connector-service is a REST-based platform service that can be used to manage OPC UA connections, and to provide them to xUML services, e.g. developed with the Designer. On startup, the service creates connections to every configured OPC UA server and registers any needed subscriptions. For the service to work properly you need to configure every OPC UA connection within the PAS Administration.
You can access as many servers as needed. Each registered server
provides a POST request to set a value to a node
provides a GET request to get a single value from a node
handles registered subscriptions (if defined) in a separate worker thread.
Each time the value of a monitored item is updated, your defined endpoint is called with this value as the payload.
How to Configure the OPC UA Connector Service
Open the PAS Administration to search for the opcua-connector-service (refer to Working With the Administration for more information). Click the service name to open its details page:
Open section Configuration:
For the configuration of the opcua-connector-service, open tab servers. Use option Add to create a new server data object or open an existing one to access the configuration details:
Click the Key to open a data object:
Enter your configuration details (refer to Configuration Reference) and Save your changes:
Nested configuration options like complex data objects or groups are displayed as link:
Click the link to open the details. To navigate back, use the links in the sidebar or the breadcrump navigation on top:
Click Save:
A summary of your changes is displayed. Click Save to apply them:
Restarting the container is not necessary, changes are applied to the service directly.
Configuration Watching
The configuration file is being watched. For changes that are stable for 10 seconds without further changes occurring in the meantime, the modified server array is read and the number of running servers/established connections is updated accordingly. The id field is important for this mechanism: It is used to identify a server during its whole lifetime.
The following cases can occur on id-identified servers:
New ID: The ID in the server configuration object is new (no object with this specific ID existed before): A new connector instance will be created for this server configuration.
Duplicate ID: For an existing connector another object having the same ID is found in the updated configuration: The corresponding instance will be shut down and re-created with the new configuration.
Missing ID: For an existing connector no object with the ID can be found in the referencing array: The running instance is canceled because it should no longer exist.
Configuration Reference
Option | Type | Description | Allowed Values / Example | |||||
---|---|---|---|---|---|---|---|---|
servers | Array | Specify a list of OPC UA servers that the opcua-connector-service should connect to. | ||||||
id | String | Specify an internal name for the connector to refer to the connector later. | ACME_OPCUA | |||||
host | String | Specify the host the OPC UA server is running on. | | |||||
port | String | Specify the port of the OPC UA server. | 26543 | |||||
username | String | Specify credentials if necessary. | ||||||
password | ||||||||
securityMode | Integer | Specify a security mode for each server to use. | 0 | |||||
1 | Apply security mode None (default). | |||||||
2 | Apply security mode Sign. | |||||||
3 | Apply security mode SignAndEncrypt. | |||||||
securityPolicy | String | Specify a link to the OPC UA security policy to use with the securityMode. Refer to the OPC UA documentation for more information and a list of the links. | No security (default). | |||||
noMainSession | Boolean | Specify if this server should have a main session for getting and setting values or not. | true | This server configuration has no main session but only manages the listed subscriptions. It is e.g. not listed when getting a list of all available connections. | ||||
false | This is the configuration for the main session of the OPC UA server (default). | |||||||
requestedSessionTimeout | Integer | Specify the session timeout for the server session. The default of 60000 should be sufficient - only change this if you are running into problems. | 60000 | Default session timeout. | ||||
connectionStrategy | Specify the OPC UA reconnect options on connection loss. |
The default values should cover most cases. Only change these values if you run into problems and know what you are doing. | ||||||
| maxRetry | Integer | Specify the maximum count of retries the opcua-connector-service should perform on connection loss. | 10 | Try 10 times (default). | |||
-1 | Try endless times. | |||||||
initialDelay | Integer | Specify the wait time in milliseconds the opcua-connector-service should wait before trying to re-establish the connection on connection loss. | 10 | Wait 10 milliseconds (default). | ||||
maxDelay | Integer | The opcua-connector-service tries to re-connect in random intervals. | 10000 | Pause no longer than 10.000 milliseconds (default). | ||||
subscriptions | Array | Specify a list of subscriptions the opcua-connector-service should listen on. | ||||||
name | String | Specify a name for the subscription. This will be the name of the related worker. We recommend using the format | get.example_message | |||||
endpoint | String | Specify the service endpoint messages should be forwarded to. This must be a valid endpoint e.g. of a message event of a Designer service. | http://bridge:14045/rest/process/OPCUA_message_send_receive/Receive_message | |||||
nodeIds | Array of String | Specify a list of nodes that the opcua-connector-service should listen on. A change in any of these nodeIds will result in a POST request to the specified endpoint. Node ids consist of a namespace and the actual node (see example). | ["ns=1;s=example_node"] | |||||
options | | Specify an option object. | | |||||
| requestedPublishingInterval | Integer | Regarding these options, refer to the OPC UA documentation. | 1000 | Default value. | |||
requestedLifetimeCount | Integer | 1000 | Default value. | |||||
requestedMaxKeepAliveCount | Integer | 10 | Default value. | |||||
maxNotificationsPerPublish | Integer | 0 | Default value. | |||||
publishingEnabled | Boolean | true | Default value. | |||||
priority | Integer | 1 | Default value. | |||||
monitor | ||||||||
| samplingInterval | Integer | 1000 | Default value. | ||||
discardOldest | Boolean | true | Default value. | |||||
queueSize | Integer | 100 | Default value. | |||||
timeouts | Specify a timeout object. | |||||||
recoverFromPanicTimeout | Integer | Specify how long (in ms) a connection is allowed to be in the panic state, where a (fast) "soft-reset" is still possible, before a "hard-reset" (~ 2-8 seconds) will be triggered. | 10000 | Default value. | ||||
recoverFromBadSessionTimeout | Integer | Determine how long the service should re-try to use an old session, that might no longer exist server-sided. This avoids infinite re-connection loops by hard-resetting the connection when the timeout is over. | 10000 | Default value. |
Related Pages:
Related Documentation: