Skip to main content

distributed_system

Macro distributed_system 

Source
macro_rules! distributed_system {
    (
        server: tcp @ $addr:expr => {
            name: $name:expr,
            strategy: $strategy:ident,
            workers: [ $(($id:expr, $factory:expr, $policy:ident)),* $(,)? ],
            supervisors: [ $($sup:expr),* $(,)? ]
        }
    ) => { ... };
    (
        server: unix @ $path:expr => {
            name: $name:expr,
            strategy: $strategy:ident,
            workers: [ $(($id:expr, $factory:expr, $policy:ident)),* $(,)? ],
            supervisors: [ $($sup:expr),* $(,)? ]
        }
    ) => { ... };
}
Expand description

Create and start a distributed supervision system with server and client

§Examples

// Ignored due to requiring actual network binding
use ash_flare::distributed_system;

distributed_system! {
    server: tcp @ "127.0.0.1:8080" => {
        name: "remote-app",
        strategy: OneForOne,
        workers: [
            ("worker-1", || MyWorker::new(), Permanent),
        ],
        supervisors: []
    }
}