#![allow(special_module_name)] use std::rc::Rc; use distributed_systems_flyio::{ types::{EchoMessage, Message}, Malestorm, }; fn main() { let mut program = Malestorm::default(); program.register("echo", |mut msg: Message, program: Rc| { let message_body: EchoMessage = serde_json::from_value(msg.body.message_body).expect("error in parsing message body"); msg.body.message_type = "echo_ok".into(); msg.body.message_body = serde_json::to_value(message_body).unwrap(); match program.reply(msg) { Ok(_) => (), Err(e) => { eprintln!("error in writing response: {}", e); } } }); program.run(); }