64e3fbe035
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
Adds <summary>, <param>, <typeparam>, and <inheritdoc/> tags to public members surfaced by commentchecker — resolves 5,847 of 5,869 issues (99.6%) across three /fixdocs passes.
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using Opc.Ua;
|
|
using Opc.Ua.Client;
|
|
using Serilog;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Adapters;
|
|
|
|
/// <summary>
|
|
/// Production session factory that creates real OPC UA sessions.
|
|
/// </summary>
|
|
internal sealed class DefaultSessionFactory : ISessionFactory
|
|
{
|
|
private static readonly ILogger Logger = Log.ForContext<DefaultSessionFactory>();
|
|
|
|
/// <summary>Creates a new OPC UA session.</summary>
|
|
/// <param name="config">The OPC UA application configuration.</param>
|
|
/// <param name="endpoint">The endpoint description to connect to.</param>
|
|
/// <param name="sessionName">The name for the session.</param>
|
|
/// <param name="sessionTimeoutMs">The session timeout in milliseconds.</param>
|
|
/// <param name="identity">The user identity for the session.</param>
|
|
/// <param name="ct">The cancellation token.</param>
|
|
/// <returns>An adapter wrapping the created session.</returns>
|
|
public async Task<ISessionAdapter> CreateSessionAsync(
|
|
ApplicationConfiguration config,
|
|
EndpointDescription endpoint,
|
|
string sessionName,
|
|
uint sessionTimeoutMs,
|
|
UserIdentity identity,
|
|
CancellationToken ct)
|
|
{
|
|
var endpointConfig = EndpointConfiguration.Create(config);
|
|
var configuredEndpoint = new ConfiguredEndpoint(null, endpoint, endpointConfig);
|
|
|
|
var session = await Session.Create(
|
|
config,
|
|
configuredEndpoint,
|
|
false,
|
|
sessionName,
|
|
sessionTimeoutMs,
|
|
identity,
|
|
null);
|
|
|
|
Logger.Information("Session created: {SessionName} -> {EndpointUrl}", sessionName, endpoint.EndpointUrl);
|
|
return new DefaultSessionAdapter(session);
|
|
}
|
|
} |