From 7615466f184bf5bdd07912e717a8c0e57b2dea51 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Thu, 5 Sep 2024 13:47:30 +0100 Subject: [PATCH] refactor: include topic prefix in c8y last-will service name Signed-off-by: James Rhodes --- crates/core/tedge_mapper/src/c8y/mapper.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/core/tedge_mapper/src/c8y/mapper.rs b/crates/core/tedge_mapper/src/c8y/mapper.rs index e1f4dd1f96..c6a89cb69f 100644 --- a/crates/core/tedge_mapper/src/c8y/mapper.rs +++ b/crates/core/tedge_mapper/src/c8y/mapper.rs @@ -280,6 +280,7 @@ pub fn service_monitor_client_config( .clone() .parse() .context("Invalid device_topic_id")?; + let prefix = &tedge_config.c8y.bridge.topic_prefix; let mapper_service_topic_id = entity_topic_id .default_service_for_device(c8y_mapper_name) @@ -294,12 +295,12 @@ pub fn service_monitor_client_config( service_type.as_str(), "down", &[], - &tedge_config.c8y.bridge.topic_prefix, + prefix, )?; let mqtt_config = tedge_config .mqtt_config()? - .with_session_name("last_will_c8y_mapper") + .with_session_name(format!("last_will_{prefix}_mapper")) .with_last_will_message(last_will_message); Ok(mqtt_config) }