update coordinator and add end to end tests

This commit is contained in:
Timur Gordon
2025-11-19 10:34:28 +01:00
parent 7675dc2150
commit 8c33c73b3c
8 changed files with 830 additions and 10 deletions

View File

@@ -70,6 +70,21 @@ struct Cli {
help = "Bind port for WebSocket JSON-RPC server (default: 9653)"
)]
api_ws_port: u16,
#[arg(
long = "supervisor-transport",
env = "SUPERVISOR_TRANSPORT",
default_value = "mycelium",
help = "Transport to use for supervisor communication: 'mycelium' or 'http' (default: mycelium)"
)]
supervisor_transport: String,
#[arg(
long = "supervisor-http-url",
env = "SUPERVISOR_HTTP_URL",
help = "HTTP URL for supervisor when using HTTP transport (e.g., http://127.0.0.1:3031)"
)]
supervisor_http_url: Option<String>,
}
#[tokio::main]
@@ -99,8 +114,9 @@ async fn main() {
// Shared application state
let state = Arc::new(herocoordinator::rpc::AppState::new(service));
// Start router workers (auto-discovered contexts) using a single global SupervisorHub (no separate inbound listener)
{
// Start router workers (auto-discovered contexts) using a single global SupervisorHub
// Skip router if using HTTP transport (no mycelium needed)
if cli.supervisor_transport == "mycelium" {
let base_url = format!("http://{}:{}", cli.mycelium_ip, cli.mycelium_port);
let hub = herocoordinator::clients::SupervisorHub::new(
base_url.clone(),
@@ -118,6 +134,9 @@ async fn main() {
};
// Per-context outbound delivery loops (replies handled by SupervisorHub)
let _auto_handle = herocoordinator::router::start_router_auto(service_for_router, cfg);
info!("Router started with mycelium transport");
} else {
info!("Skipping router - using HTTP transport for supervisor communication");
}
// Build RPC modules for both servers