diff --git a/gateway/src/IntegrationGateway.Host/Program.cs b/gateway/src/IntegrationGateway.Host/Program.cs index 930aba9..c75e03e 100644 --- a/gateway/src/IntegrationGateway.Host/Program.cs +++ b/gateway/src/IntegrationGateway.Host/Program.cs @@ -30,8 +30,27 @@ var volProUrl = gwCfg["VolProBaseUrl"] ?? "http://localhost:9100"; var httpFactory = app.Services.GetRequiredService(); var clientFactory = new GatewayClientFactory(httpFactory, volProUrl); -// 适配器将在 Phase G2/G3 注册,此处预留 -Console.WriteLine("[Gateway] AdapterRegistry initialized, awaiting adapters..."); +// 注册 OwlAdapter +var owlHttp = app.Services.GetRequiredService().CreateClient("VolPro"); +var owlAdapter = new IntegrationGateway.Adapters.Owl.OwlAdapter( + "Owl:main", owlHttp, + owlCfg["BaseUrl"] ?? "http://localhost:15123", + owlCfg["Username"] ?? "admin", + owlCfg["Password"] ?? "admin" +); +registry.Register(owlAdapter); + +// 注册 MC4Adapter +var mc4Http = app.Services.GetRequiredService().CreateClient("VolPro"); +var mc4Adapter = new IntegrationGateway.Adapters.MC4.Mc4Adapter( + "MC4:31ku", mc4Http, + mc4Cfg["BaseUrl"] ?? "http://localhost:3000" +); +registry.Register(mc4Adapter); + +// 并行初始化适配器 +await registry.InitializeAllAsync(); +Console.WriteLine($"[Gateway] {registry.All.Count} adapter(s) registered"); // ═══ B 组路由 ═══