refactor(historian): remove named-pipe transport
This commit is contained in:
+17
-9
@@ -66,11 +66,16 @@ else
|
||||
<div class="panel-head">Connection</div>
|
||||
<div style="padding:1rem">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Named pipe name</label>
|
||||
<InputText @bind-Value="_form.Historian.PipeName" class="form-control form-control-sm mono"
|
||||
placeholder="otopcua-historian" />
|
||||
<div class="form-text">Must match the sidecar's <code>OTOPCUA_HISTORIAN_PIPE</code> environment variable.</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Sidecar host</label>
|
||||
<InputText @bind-Value="_form.Historian.Host" class="form-control form-control-sm mono"
|
||||
placeholder="localhost" />
|
||||
<div class="form-text">DNS name or IP the historian sidecar's TCP listener is reachable at.</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">Sidecar port</label>
|
||||
<InputNumber @bind-Value="_form.Historian.Port" class="form-control form-control-sm mono" />
|
||||
<div class="form-text">Must match the sidecar's <code>OTOPCUA_HISTORIAN_TCP_PORT</code>.</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Shared secret</label>
|
||||
@@ -209,7 +214,7 @@ else
|
||||
}
|
||||
|
||||
private static WonderwareHistorianClientOptions CreateDefaultOptions() =>
|
||||
new(PipeName: "otopcua-historian", SharedSecret: "");
|
||||
new(Host: "localhost", Port: 32569, SharedSecret: "");
|
||||
|
||||
private async Task SubmitAsync()
|
||||
{
|
||||
@@ -309,7 +314,8 @@ else
|
||||
/// </summary>
|
||||
public sealed class WonderwareHistorianClientFormModel
|
||||
{
|
||||
public string PipeName { get; set; } = "otopcua-historian";
|
||||
public string Host { get; set; } = "localhost";
|
||||
public int Port { get; set; } = 32569;
|
||||
public string SharedSecret { get; set; } = "";
|
||||
public string PeerName { get; set; } = "OtOpcUa";
|
||||
public int? ConnectTimeoutSeconds { get; set; }
|
||||
@@ -318,7 +324,8 @@ else
|
||||
|
||||
public static WonderwareHistorianClientFormModel FromRecord(WonderwareHistorianClientOptions r) => new()
|
||||
{
|
||||
PipeName = r.PipeName,
|
||||
Host = r.Host,
|
||||
Port = r.Port,
|
||||
SharedSecret = r.SharedSecret,
|
||||
PeerName = r.PeerName,
|
||||
ConnectTimeoutSeconds = r.ConnectTimeout.HasValue ? (int)r.ConnectTimeout.Value.TotalSeconds : null,
|
||||
@@ -327,7 +334,8 @@ else
|
||||
};
|
||||
|
||||
public WonderwareHistorianClientOptions ToRecord() => new(
|
||||
PipeName: PipeName,
|
||||
Host: Host,
|
||||
Port: Port,
|
||||
SharedSecret: SharedSecret,
|
||||
PeerName: PeerName,
|
||||
ConnectTimeout: ConnectTimeoutSeconds.HasValue ? TimeSpan.FromSeconds(ConnectTimeoutSeconds.Value) : null,
|
||||
|
||||
@@ -88,15 +88,15 @@ if (hasDriver)
|
||||
|
||||
// Config-gated durable alarm-historian sink. When the AlarmHistorian section is enabled this
|
||||
// overrides the NullAlarmHistorianSink default from AddOtOpcUaRuntime (last registration wins)
|
||||
// with a SqliteStoreAndForwardSink draining to the Wonderware named-pipe writer. The writer is
|
||||
// with a SqliteStoreAndForwardSink draining to the Wonderware TCP writer. The writer is
|
||||
// injected here because the Host is the only project that references the Wonderware client —
|
||||
// Runtime owns the gating + Sqlite construction, the Host supplies the concrete downstream.
|
||||
builder.Services.AddAlarmHistorian(
|
||||
builder.Configuration,
|
||||
(opts, sp) => new WonderwareHistorianClient(
|
||||
new WonderwareHistorianClientOptions(opts.PipeName, opts.SharedSecret)
|
||||
new WonderwareHistorianClientOptions(opts.Host, opts.Port, opts.SharedSecret)
|
||||
{
|
||||
Host = opts.Host, Port = opts.Port, UseTls = opts.UseTls, ServerCertThumbprint = opts.ServerCertThumbprint,
|
||||
UseTls = opts.UseTls, ServerCertThumbprint = opts.ServerCertThumbprint,
|
||||
},
|
||||
sp.GetService<ILogger<WonderwareHistorianClient>>()));
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ZB.MOM.WW.OtOpcUa.Runtime.Historian;
|
||||
/// Binds the <c>AlarmHistorian</c> configuration section that gates the durable
|
||||
/// store-and-forward alarm sink. When <see cref="Enabled"/> is <c>true</c>,
|
||||
/// <c>AddAlarmHistorian</c> registers a <c>SqliteStoreAndForwardSink</c> (draining to the
|
||||
/// Wonderware named-pipe writer supplied by the Host) in place of the
|
||||
/// Wonderware TCP writer supplied by the Host) in place of the
|
||||
/// <c>NullAlarmHistorianSink</c> default; otherwise the Null default survives.
|
||||
/// </summary>
|
||||
public sealed class AlarmHistorianOptions
|
||||
@@ -25,9 +25,6 @@ public sealed class AlarmHistorianOptions
|
||||
/// <summary>Filesystem path to the local SQLite store-and-forward queue database.</summary>
|
||||
public string DatabasePath { get; init; } = "alarm-historian.db";
|
||||
|
||||
/// <summary>Named-pipe name the Wonderware historian sidecar listens on.</summary>
|
||||
public string PipeName { get; init; } = "OtOpcUaHistorian";
|
||||
|
||||
/// <summary>TCP hostname or IP address the Wonderware historian sidecar listens on.</summary>
|
||||
public string Host { get; init; } = "localhost";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user