File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 22
33A rabbit MQ abstraction build upon [ Lapin] ( https://crates.io/crates/lapin/1.0.2 )
44
5- ## Example
5+ ## Consumer example
66
77``` rust
88fn main () {
@@ -21,6 +21,32 @@ fn handler(_delivery: &Delivery) -> HandleMessageResult {
2121}
2222```
2323
24+ ## Publisher example
25+
26+ ``` rust
27+ fn main () {
28+ let config : JSONConfiguration = configuration :: reader :: read (" ./config.json" ). unwrap ();
29+ println! (" [{}] - Configuration read" , line! (),);
30+
31+ LocalPool :: new (). run_until (async {
32+ loop {
33+ let outcome = publish (
34+ " test" . to_string (),
35+ & config . binding. exchange,
36+ & config . binding. routing_key,
37+ config . connection. clone (),
38+ )
39+ . await ;
40+
41+ println! (" [{}] - {:?}" , line! (), outcome );
42+
43+ let delay = time :: Duration :: from_millis (500 );
44+ thread :: sleep (delay );
45+ }
46+ });
47+ }
48+ ```
49+
2450## JSONConfiguration configuration example
2551
2652
You can’t perform that action at this time.
0 commit comments