Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public class OpcUaClient {
* Create an {@link OpcUaClient} configured with {@code config}.
*
* @param config the {@link OpcUaClientConfig}.
* @return an {@link OpcUaClient} configured with {@code config}.
* @throws UaException if the client could not be created (e.g. transport/encoding not supported).
* @return a new {@link OpcUaClient} configured with {@code config}.
* @throws UaException if the client could not be created.
*/
public static OpcUaClient create(OpcUaClientConfig config) throws UaException {
OpcTcpClientTransportConfig transportConfig = OpcTcpClientTransportConfig.newBuilder().build();
Expand All @@ -188,6 +188,27 @@ public static OpcUaClient create(OpcUaClientConfig config) throws UaException {
return new OpcUaClient(config, transport);
}

/**
* Create an {@link OpcUaClient} configured with {@code config}.
*
* @param config the {@link OpcUaClientConfig}.
* @param configureTransport a Consumer that receives an {@link
* OpcTcpClientTransportConfigBuilder} that can be used to configure the transport.
* @return a new {@link OpcUaClient} configured with {@code config}.
* @throws UaException if the client could not be created.
*/
public static OpcUaClient create(
OpcUaClientConfig config, Consumer<OpcTcpClientTransportConfigBuilder> configureTransport)
throws UaException {

var transportConfigBuilder = OpcTcpClientTransportConfig.newBuilder();
configureTransport.accept(transportConfigBuilder);

OpcTcpClientTransportConfig transportConfig = transportConfigBuilder.build();

return new OpcUaClient(config, new OpcTcpClientTransport(transportConfig));
}

/**
* Select the first endpoint with no security that allows anonymous connections and create an
* {@link OpcUaClient} with the default configuration.
Expand Down