Message brokers which allow for simple communication between Spectacles services.
```rust,norun use std::env::var; use std::net::SocketAddr; use futures::future::Future; use spectacles_brokers::amqp::*;
fn main() { let addr = var("AMQPADDR").expect("No AMQP server address found."); let connect = AmqpBroker::new(&addr, "test".tostring(), None); let result = connect.andthen(|broker| { let json = r#"{"message": "Example Publish."}"#.asbytes(); broker.publish( "HELLO", json.tovec(), AmqpProperties::default().withcontenttype("application/json".tostring() ) }); let success = result.map(|| { println!("Message publish succeeded, check the other window!"); }).maperr(|err| { eprintln!("An error was encountered during publish: {}", err); });
tokio::run(success);
}
```
More examples can be found in the [examples
] directory.