PhaseG3_register: 适配器注册到Host,全链路编译通过
This commit is contained in:
@@ -30,8 +30,27 @@ var volProUrl = gwCfg["VolProBaseUrl"] ?? "http://localhost:9100";
|
||||
var httpFactory = app.Services.GetRequiredService<IHttpClientFactory>();
|
||||
var clientFactory = new GatewayClientFactory(httpFactory, volProUrl);
|
||||
|
||||
// 适配器将在 Phase G2/G3 注册,此处预留
|
||||
Console.WriteLine("[Gateway] AdapterRegistry initialized, awaiting adapters...");
|
||||
// 注册 OwlAdapter
|
||||
var owlHttp = app.Services.GetRequiredService<IHttpClientFactory>().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<IHttpClientFactory>().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 组路由 ═══
|
||||
|
||||
|
||||
Reference in New Issue
Block a user