diff options
Diffstat (limited to 'mapper/cumulocity/c8y_mapper/src/main.rs')
-rw-r--r-- | mapper/cumulocity/c8y_mapper/src/main.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mapper/cumulocity/c8y_mapper/src/main.rs b/mapper/cumulocity/c8y_mapper/src/main.rs new file mode 100644 index 00000000..a5637823 --- /dev/null +++ b/mapper/cumulocity/c8y_mapper/src/main.rs @@ -0,0 +1,28 @@ +use env_logger::Env; + +use mqtt_client::Client; + +mod mapper; + +const DEFAULT_LOG_LEVEL: &str = "warn"; +const APP_NAME: &str = "tedge-mapper"; + +#[tokio::main] +async fn main() -> Result<(), mqtt_client::Error> { + env_logger::Builder::from_env(Env::default().default_filter_or(DEFAULT_LOG_LEVEL)).init(); + + log::info!("tedge-mapper starting!"); + + let config = mqtt_client::Config::default(); + let mqtt = Client::connect(APP_NAME, &config).await?; + + let mapper = mapper::Mapper::new_from_string( + mqtt, + mapper::IN_TOPIC, + mapper::C8Y_TOPIC_C8Y_JSON, + mapper::ERRORS_TOPIC, + )?; + mapper.run().await?; + + Ok(()) +} |