use std::fs; use std::path::PathBuf; use json::object; use log::info; use df_kafka::Kafka; fn main() { env_logger::init(); let mut root_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); root_path = root_path.join(".."); let conf_path = root_path.join("config"); let conf_path = conf_path.join("kafka.json"); let conf = match fs::read_to_string(conf_path) { Ok(content) => { if content == "" { object! {} } else { json::parse(content.as_str()).unwrap() } } Err(_) => { object! {} } }; let kafka = Kafka::connect(conf); let data = kafka.set("tests", "", "112".into()); info!(">>>>>>{}", data); let data = kafka.set("tests", "", "113".into()); info!(">>>>>>{}", data); let data = kafka.get("tests", "", false); info!(">>>>>>{}", data); }