1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Lightweight TCP-based pub/sub message broker.
//!
//! This crate re-exports the consumer-facing API so users only need
//! a single dependency.
//!
//! # Quick start
//!
//! ```ignore
//! use std::time::Duration;
//! use topiq::{Client, ConnectOptions};
//!
//! #[tokio::main]
//! async fn main() -> topiq::Result<()> {
//! let client = Client::connect(ConnectOptions::default()).await?;
//!
//! // Publish (accepts &str, String, Vec<u8>, Bytes, etc.)
//! client.publish("greet", "hello world").await?;
//!
//! // Subscribe
//! let mut sub = client.subscribe("greet").await?;
//! let msg = sub.next_message().await.unwrap();
//! assert_eq!(msg.payload.as_ref(), b"hello world");
//!
//! // Request/reply
//! let reply = client.request("service.echo", "ping", Duration::from_secs(5)).await?;
//!
//! client.close().await;
//! Ok(())
//! }
//! ```
//!
//! Add `topiq` to your `Cargo.toml`:
//! ```toml
//! [dependencies]
//! topiq = "0.1"
//! ```
// Re-export bytes::Bytes so users don't need a separate `bytes` dependency.
pub use Bytes;
// Client types.
pub use ;
// Core types that users interact with.
pub use ;
/// Server-side types for embedding a broker in your application.
///
/// Enable with the `server` feature flag:
/// ```toml
/// [dependencies]
/// topiq = { version = "0.1", features = ["server"] }
/// ```