fix(dcl): feed ScadaBridge:MxGateway:ClientNamePrefix into the MxGateway client-name fallback (review 2026-10-21 02/U1, 08/O2)

This commit is contained in:
Joseph Doherty
2026-10-22 06:29:05 -04:00
parent f18d3adbfc
commit 3543a7f295
6 changed files with 71 additions and 6 deletions
@@ -35,11 +35,13 @@ public class DataConnectionFactory : IDataConnectionFactory
/// construction without it keeps literal-key behaviour.
/// </param>
/// <param name="dataConnectionOptions">Optional data connection options, such as the MxGateway supervisory-advise parallelism; defaults apply when null.</param>
/// <param name="mxGatewayGlobalOptions">Optional MxGateway global options (the client-name fallback); defaults apply when null.</param>
public DataConnectionFactory(
ILoggerFactory loggerFactory,
IOptions<OpcUaGlobalOptions> opcUaGlobalOptions,
ISecretResolver? secretResolver = null,
IOptions<DataConnectionOptions>? dataConnectionOptions = null)
IOptions<DataConnectionOptions>? dataConnectionOptions = null,
IOptions<MxGatewayGlobalOptions>? mxGatewayGlobalOptions = null)
{
_loggerFactory = loggerFactory;
_secretResolver = secretResolver;
@@ -48,6 +50,9 @@ public class DataConnectionFactory : IDataConnectionFactory
// DataConnectionOptions is consumed by the actor, which is constructed elsewhere.
var supervisoryAdviseParallelism =
(dataConnectionOptions?.Value ?? new DataConnectionOptions()).MxSupervisoryAdviseParallelism;
// The client registration name a connection with a blank ClientName falls back to
// (review 2026-10-21 02/U1 — the option was bound and validated but never read).
var mxClientNamePrefix = (mxGatewayGlobalOptions?.Value ?? new MxGatewayGlobalOptions()).ClientNamePrefix;
// Register built-in protocols.
// Pass the ILoggerFactory into RealOpcUaClientFactory so
@@ -64,7 +69,8 @@ public class DataConnectionFactory : IDataConnectionFactory
new RealMxGatewayClientFactory(_loggerFactory),
_loggerFactory.CreateLogger<MxGatewayDataConnection>(),
_secretResolver,
supervisoryAdviseParallelism));
supervisoryAdviseParallelism,
mxClientNamePrefix));
}
/// <summary>