Skip to content

Configuration

Kevin Herron edited this page Oct 5, 2026 · 6 revisions

Applies to Milo 1.2.0-SNAPSHOT. Source baseline 7faaf4f05, 2026-10-04.

Use the client and server builders to configure an application before creating its runtime objects. This page explains the settings that commonly interact; the linked API source is the exhaustive reference. Use one Milo version throughout the application and resolve endpoint, identity, and resource ownership first.

Client settings

Setting Unit/default at this baseline Effect and responsibility
setEndpoint EndpointDescription Select a discovered endpoint with the intended policy, mode, and token policies. Changing a hostname does not establish trust.
setSessionTimeout Milliseconds; 120,000 Requested Session timeout. Inspect the server's revised value; this is not a per-operation timeout.
setRequestTimeout Milliseconds; 60,000 Request deadline. Timeouts on writes or Methods can leave the outcome unknown; do not blindly retry non-idempotent work.
setKeepAliveInterval, setKeepAliveTimeout Milliseconds; 5,000 each Session health checking. Choose values appropriate to expected latency and failures; these are distinct from Subscription keep-alives.
setKeepAliveFailuresAllowed Consecutive failures; 1 Works with the keep-alive interval and timeout to determine when the Session enters an error state.
setOperationLimitOverrides Operation counts; no overrides Overrides the client's effective operation-limit values. It does not force the server to accept larger requests or automatically partition arbitrary service calls.
setEndpointResolver Resolver callback; absent on a bare config builder Allows endpoint-certificate refresh during recovery. URL-based creation supplies a resolver; config-based creation needs an explicitly configured resolver for that behavior.

A config builder defaults to anonymous identity. OpcUaClient.create(String) selects the first endpoint offering SecurityPolicy None and anonymous tokens. Use the selector overload for a secured endpoint. If neither a certificate group nor an explicit certificate validator is configured, the client does not validate server certificates. Supply an application identity or certificate group and a validator with the intended trust policy; selecting a secured policy alone does not establish trust. See Connecting, Client security, and Recovery and limits.

Encoding and operation limits

EncodingLimits.DEFAULT allows messages up to 2 MiB, chunks up to 65,535 bytes, up to 64 chunks, and recursion depth 128. Transport limits, the server's advertised operation counts, and application memory limits are different constraints. A request with few large values can exceed a message limit even when its operation count fits.

OpcUaClientConfigBuilder.setEncodingLimits(...) and OpcUaServerConfigBuilder.setEncodingLimits(...) set these limits before startup. EncodingLimits rejects a chunk size below 8,196 bytes. The client also has setMaxResponseMessageSize(...), whose default 0 means no response-size limit is requested from the server; this does not remove local encoding limits. Partition large operations at application boundaries, preserve request/result ordering, and inspect service and per-operation status. A zero value in a protocol field can mean no advertised limit; do not generalize that interpretation to every builder property. See Encodings and the exact setter Javadoc before choosing a value.

Server and endpoint settings

EndpointConfig separates the local bind address from the advertised hostname, but uses the same bindPort in the listener and advertised URL. There is no separate advertised-port setting. Defaults are bind address localhost, hostname localhost, and port 12685, so a default endpoint is local-only. A wildcard bind address is not a usable remote hostname. Publish a name clients can resolve and reach and include the corresponding certificate names for secured endpoints. See Deployment for NAT and port mapping.

OpcUaServerConfig connects endpoints, certificate manager, identity validator, role mapper, access controller factory, encoding limits, and service limits. The builder starts with the placeholder application URI server application uri not configured, an AnonymousIdentityValidator, and no certificate manager. Supply a persistent application URI and a certificate manager explicitly, and choose the intended user-token validator. Authentication and authorization are separate configuration steps. A user accepted by the identity validator is not automatically authorized to read, write, or call every Node. Use Access control for effective user attributes and invalidation.

Common defaults from OpcUaServerConfigLimits are below. Counts are maxima unless stated otherwise; the length fields are advertised server capabilities.

Limit or capability Default
Sessions; Session timeout 100 Sessions; maximum 120,000 ms
Publishing interval Minimum 10 ms; default 250 ms; maximum 8 hours
Nodes per Read or Write; monitored items per call 10,000 each
Nodes per Browse, Method Call, or TranslateBrowsePathsToNodeIds 250 each
String, ByteString, and array maximum lengths 1,048,576 each; array length counts elements
Browse, Query, and History continuation points 250 for each kind
Password length 1,024 bytes

The History continuation-point count and the four history-specific operation limits are advertised values; the history provider must enforce consistent limits. See Historical access for the default dispatch checks and provider responsibilities. The Query continuation-point value does not imply Query support: the default Query service is unsupported. See Capabilities and limitations.

Supply an OpcUaServerConfigLimits implementation through setLimits(...) when defaults do not fit. Verify both normal workload and limit rejection. Avoid tuning solely from a desired throughput number; sample payload size, service latency, queues, and resource use first.

Subscriptions and sampling

The client requests publishing, lifetime, keep-alive, sampling, and queue parameters. The server revises them within its constraints. Read the revised parameters and per-item statuses before treating a subscription as ready. Sampling is data acquisition; publishing is notification delivery.

On a ManagedAddressSpace, SamplingManagerConfig controls interval grouping, minimum intervals, first-sample debounce, and read-access refresh policy. Defaults are a 25 ms bucket and 1 ms minimum, so the fastest supported sampling interval is 25 ms. Initial sampling waits 100 ms for more items, with a maximum 500 ms window. Read access refreshes per cycle by default. Custom device groups still need to honor access decisions and lifecycle. See Subscriptions and Sampling for setup and migration.

Executors and lifetime

Client worker resources are configured on OpcTcpClientTransportConfigBuilder, available through the configureTransport consumer of OpcUaClient.create(...). Its setExecutor, setScheduledExecutor, setEventLoop, and setWheelTimer setters default to the corresponding Stack shared resources. Server SDK builders default to the shared executor and scheduled executor; the OPC TCP server transport defaults to the shared event loop.

Client disconnect and server shutdown stop their client/server activity, not the shared resources or executors the application supplied. The application owns the sizing and eventual shutdown of resources it supplies. Stop every user before closing a shared application executor, event loop, or timer. Do not block transport/event-loop callbacks with device I/O or application waits.

Shut down clients, servers, namespace work, and application-owned resources in the order described in Deployment. Stack.releaseSharedResources() is a process-wide final cleanup, not the cleanup for one client in a process that still hosts other Milo components.

Examples and reference

The first server gives a complete local endpoint configuration. The security guides extend this with certificates and trust. For a failed configuration, capture the selected endpoint, resolved application identity, requested/revised limits, and operation status before making changes.

Related pages

Reference · Client connecting · Server configuration · Deployment

Clone this wiki locally