Skip to content

Commit ea9d00e

Browse files
authored
fix: allow router to be registered as general transport type (#4633)
Signed-off-by: PeaBrane <[email protected]>
1 parent 6a0e67e commit ea9d00e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/llm/src/discovery/model_manager.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ use parking_lot::{Mutex, RwLock};
1010
use tokio::sync::oneshot;
1111

1212
use dynamo_runtime::{
13-
component::{Endpoint, TransportType},
13+
component::{Endpoint, build_transport_type},
1414
discovery::DiscoverySpec,
1515
prelude::DistributedRuntimeProvider,
1616
protocols::EndpointId,
17-
transports::nats,
1817
};
1918

2019
use crate::{
@@ -318,18 +317,18 @@ impl ModelManager {
318317
// Register router via discovery mechanism
319318
let discovery = endpoint.component().drt().discovery();
320319
let instance_id = discovery.instance_id();
320+
let request_plane_mode = endpoint.drt().request_plane();
321321

322-
// Build NATS transport subject for the router endpoint
322+
// Build transport for router endpoint based on request plane mode
323323
// Use KV_ROUTER_COMPONENT as the component name to distinguish from the generate endpoint's component
324324
let router_endpoint_id = router_endpoint_id(endpoint.id().namespace);
325-
// Placeholder subject - router is not callable, only registered for lifecycle coordination
326-
let nats_subject = nats::instance_subject(&router_endpoint_id, instance_id);
325+
let transport = build_transport_type(request_plane_mode, &router_endpoint_id, instance_id);
327326

328327
let discovery_spec = DiscoverySpec::Endpoint {
329328
namespace: router_endpoint_id.namespace.clone(),
330329
component: router_endpoint_id.component.clone(),
331330
endpoint: router_endpoint_id.name.clone(),
332-
transport: TransportType::Nats(nats_subject),
331+
transport,
333332
};
334333

335334
discovery.register(discovery_spec).await?;

lib/runtime/src/component.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ mod registry;
6565
pub mod service;
6666

6767
pub use client::Client;
68+
pub use endpoint::build_transport_type;
6869

6970
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)]
7071
#[serde(rename_all = "snake_case")]

lib/runtime/src/component/endpoint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl EndpointConfigBuilder {
256256
/// - HTTP: Uses full URL path including endpoint name (e.g., http://host:port/v1/rpc/endpoint_name)
257257
/// - TCP: Includes endpoint name for routing (e.g., host:port/endpoint_name)
258258
/// - NATS: Uses subject-based addressing (unique per endpoint)
259-
fn build_transport_type(
259+
pub fn build_transport_type(
260260
mode: RequestPlaneMode,
261261
endpoint_id: &EndpointId,
262262
connection_id: u64,

0 commit comments

Comments
 (0)