Worker

We already implemented the worker in the JSON-RPC example. In the gRPC version, we use have same code, but expect a Receiver value and don't spawn a new thread:

fn worker_loop(receiver: Receiver<Action>) -> Result<(), Error> {
let next = env::var("NEXT")?.parse()?;
let remote = Remote::new(next)?;
let mut in_roll_call = false;
for action in receiver.iter() {
match action { /* Action variants here */ }
}
Ok(())
}

Let's compile and run this example.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.17.139