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

OptionTypeDescriptionAllowed Values / Example
servers
ArraySpecify a list of OPC UA servers that the opcua-connector-service should connect to.

id
StringSpecify an internal name for the connector to refer to the connector later.
ACME_OPCUA
host
StringSpecify the host the OPC UA server is running on.
                
port
StringSpecify the port of the OPC UA server.
26543
username
StringSpecify credentials if necessary.
password

securityMode
IntegerSpecify a security mode for each server to use.0
1Apply security mode None (default).
2Apply security mode Sign.
3Apply security mode SignAndEncrypt.
securityPolicy StringSpecify 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.http://opcfoundation.org/UA/SecurityPolicy#NoneNo security (default).
noMainSession

BooleanSpecify if this server should have a main session for getting and setting values or not.trueThis 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.
falseThis is the configuration for the main session of the OPC UA server (default).
requestedSessionTimeoutIntegerSpecify the session timeout for the server session. The default of 60000 should be sufficient - only change this if you are running into problems.60000Default 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).

-1Try 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.
Specify the maximum wait interval in milliseconds between re-connection tries.

10000

Pause no longer than 10.000 milliseconds (default).

subscriptions
ArraySpecify 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 <name of the request type>.<name of the message type>. This format fits with the PAS logger and makes it easy to find worker actions in the PAS logs.
get.example_message
endpoint
StringSpecify 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
http://mqttconnector-lib:11111/rest/process/OPCUA_message_send_receive/Receive_message
nodeIds
Array of StringSpecify 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
IntegerRegarding these options, refer to the OPC UA documentation.1000Default value.
requestedLifetimeCount
Integer1000Default value.
requestedMaxKeepAliveCountInteger10Default value.
maxNotificationsPerPublish
Integer0Default value.
publishingEnabled
BooleantrueDefault value.
priority
Integer1Default value.
monitor



samplingIntervalInteger1000Default value.
discardOldest
BooleantrueDefault value.
queueSize
Integer100Default value.
timeouts

Specify a timeout object.


recoverFromPanicTimeout
IntegerSpecify 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.
This tolerance period is intended to prevent the service from falling into a state of panic and not being able to recover.
10000
Default value.
recoverFromBadSessionTimeout
IntegerDetermine 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.10000Default value.
  • No labels