Use Management Application API restart; drop stopcontainer.bat as primary.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,15 +9,14 @@ namespace ZA.CoreService.ESBCertificateManager.Services;
|
||||
/// <summary>
|
||||
/// Verwaltet Sonic ESB Container über die Management Console.
|
||||
///
|
||||
/// Modus = MfApi (Standard):
|
||||
/// Offizielle Sonic MF Management Runtime API über ConnectionUrl + SMC-Logins
|
||||
/// (JMSConnectorClient → MFProxyFactory.createAgentProxy → IAgentProxy.restart).
|
||||
/// Modus = MfApi (Standard, laut Aurea CX Messenger Doku-Index → Management Application API):
|
||||
/// Dieselbe Aktion wie „Restart“ in der Sonic Management Console:
|
||||
/// JMSConnectorClient → MFProxyFactory.createAgentProxy → IAgentProxy.restart
|
||||
/// über ConnectionUrl + SMC-User/Pass aus appsettings.
|
||||
/// stopcontainer.bat wird NICHT verwendet (existiert in vielen SMC-only Installationen nicht).
|
||||
///
|
||||
/// Modus = WinRm / LocalCmd (optionaler Fallback):
|
||||
/// PowerShell/CMD stopcontainer/startcontainer (nicht Domain-Manager-nativ).
|
||||
///
|
||||
/// Modus = HttpApi:
|
||||
/// HTTP REST API mit automatischer Pfad-Erkennung.
|
||||
/// Modus = LocalCmd / WinRm: nur optional, wenn Server-Scripts vorhanden sind.
|
||||
/// Modus = HttpApi: REST falls vorhanden.
|
||||
/// </summary>
|
||||
public sealed class SonicManagementClient : IDisposable
|
||||
{
|
||||
@@ -346,31 +345,16 @@ public sealed class SonicManagementClient : IDisposable
|
||||
$"Domain={_connection.DomainName}; ConnectionUrl={_connection.ConnectionUrl}\n{output}");
|
||||
}
|
||||
|
||||
// Kein Java / keine Client-JARs → offizieller Doku-Weg über stop/startcontainer.bat
|
||||
bool softFail = error?.Contains("Java nicht gefunden", StringComparison.OrdinalIgnoreCase) == true
|
||||
|| error?.Contains("Client-JARs", StringComparison.OrdinalIgnoreCase) == true
|
||||
|| error?.Contains("lib", StringComparison.OrdinalIgnoreCase) == true;
|
||||
|
||||
if (softFail)
|
||||
{
|
||||
SonicBinRestartExecutor bin = new(_connection);
|
||||
(bool binOk, string binStatus, string? binDetail) =
|
||||
await bin.RestartAsync(containerName, cancellationToken);
|
||||
if (binOk)
|
||||
{
|
||||
return (true, binStatus,
|
||||
$"MfApi nicht nutzbar ({Truncate(error ?? string.Empty, 160)}) – Fallback SonicBin:\n{binDetail}");
|
||||
}
|
||||
|
||||
return (false, "Neustart fehlgeschlagen (MfApi→SonicBin)",
|
||||
$"MfApi: {error}\n\nSonicBin-Fallback: {binDetail}\n" +
|
||||
$"SonicHome='{_connection.SonicHome}' muss stopcontainer.bat enthalten.");
|
||||
}
|
||||
|
||||
return (false, "Neustart fehlgeschlagen (MfApi)",
|
||||
$"IAgentProxy.restart für '{containerName}' (Domain '{_connection.DomainName}') " +
|
||||
$"über {_connection.ConnectionUrl} fehlgeschlagen.\n" +
|
||||
$"Fehler: {error}\nAusgabe: {output}");
|
||||
"Laut Doku (Management Application API / wie SMC-Restart):\n" +
|
||||
"JMSConnectorClient + MFProxyFactory.createAgentProxy + IAgentProxy.restart\n\n" +
|
||||
$"Container '{containerName}', Domain '{_connection.DomainName}', URL {_connection.ConnectionUrl}\n" +
|
||||
$"Fehler: {error}\nAusgabe: {output}\n\n" +
|
||||
"Benötigt (SMC-Installation):\n" +
|
||||
$"- SonicHome={_connection.SonicHome} mit lib\\*.jar (mgmt_client / mfcontext / sonic_Client)\n" +
|
||||
"- Java (JavaHome/JavaPath oder JRE unter SonicHome)\n" +
|
||||
"- Dieselben ConnectionUrl/User/Pass wie beim SMC-Login\n" +
|
||||
"Hinweis: stopcontainer.bat wird nicht verwendet (in SMC-only Versionen oft nicht vorhanden).");
|
||||
}
|
||||
|
||||
private static async Task<bool> IsTcpReachableAsync(string connectionUrl, CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user