manager_handlers 0.7.2

A microservice manager implementation that creates HTTP-accessible handlers with configurable replicas. Handlers communicate via an internal bus, enabling collaborative request processing in a distributed architecture.
Documentation
use crate::core::communication::multibus::MultiBus;
use crate::core::{states::SharedState, traits::Base};
use crate::handler;
use async_trait::async_trait;
use std::sync::Arc;

handler! {
    MyHandler, my_handler;
    async fn run(&self, _: String, data: String) -> Result<String, Box<dyn std::error::Error + Send + Sync>> {
        println!("Received data: {}", data);

        for i in 0..10 {
            self.dispatch(
                format!("Hello {}", i),
                "other_handler".to_string()
            ).await;
        }

        let response = self.publish(
            "Hello".to_string(),
            "other_handler".to_string(),
        ).await;
        Ok(format!("Processed data with response: {}", response))
    },
}

handler! {
    OtherHandler, other_handler;
    async fn run(&self, _: String, data: String) -> Result<String, Box<dyn std::error::Error + Send + Sync>> {
        println!("Received data: {}", data);

        Ok(format!("Hi back"))
    },
}