use std::collections::HashMap; use serde_json::{json, Value, from_value}; use streaming_platform::{client, MagicBall, sp_dto::{MsgMeta, Message, Response, resp}}; pub async fn process_event(config: HashMap, mut mb: MagicBall, msg: Message) -> Result<(), Box> { Ok(()) } pub async fn process_rpc(config: HashMap, mut mb: MagicBall, msg: Message) -> Result, Box> { resp(json!({})) } pub async fn startup(config: HashMap, mut mb: MagicBall) { let msg = mb.rpc::<_, Value>("Client", "Hi", json!({ "data": "hello" })).await; println!("{:#?}", msg); } pub fn main() { env_logger::init(); let mut config = HashMap::new(); config.insert("addr".to_owned(), "Client2".to_owned()); config.insert("host".to_owned(), "localhost:11001".to_owned()); config.insert("access_key".to_owned(), "".to_owned()); client::start(config, process_event, process_rpc, startup); }