use std::{fs, path::Path};
use xdevs_utils::{dmt::DevsModelTree, mqtt::DmtPropagator};
#[tokio::main]
async fn main() {
let subscriber = tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.finish();
tracing::subscriber::set_global_default(subscriber).unwrap();
let path = Path::new("xdevs_utils/examples/efp_deep.json");
let json_str = fs::read_to_string(path).expect("Failed to read JSON file");
let dmt = DevsModelTree::from_json(&json_str).expect("Failed to parse JSON file");
let mqtt_root = "xdevs/efp";
let mqtt_host = "0.0.0.0";
let mqtt_port = 1883;
let coupled = DmtPropagator::new(mqtt_root, "efp", mqtt_host, mqtt_port, dmt);
for handle in coupled.spawn() {
handle.await.unwrap();
}
}