Crate vertx_tcp_eventbus_bridge_client_rust

Source
Expand description

§A future based vert.x tcp eventbus client implementation for Rust.

Eventbus is the core struct to communicate with vert.x eventbus. Any further operation can be represented by a stream or future. The body of a message is a json value serde_json::value

§Example

let task = future::Eventbus::connect(IpAddr::from_str("127.0.0.1").unwrap(), 12345);
let task = task.and_then(|(eventbus, readstream, writestream)| {
    tokio::spawn(readstream.into_future().map(|_| ()).map_err(|e| ()));
    tokio::spawn(writestream.into_future().map(|_| ()).map_err(|e| ()));
    futures::future::ok(eventbus)
});
let task = task.and_then(|eventbus: Eventbus| {
    let test_reply = eventbus.send_reply("test".to_string(), json!({
        "aaaa":"bbbb"
    })).unwrap().and_then(|response| {
        println!("{:?}", response);
        futures::future::ok(())
    });
    test_reply
});
tokio::run(task.map_err(|e| ()));

Modules§