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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! ZeroMQ protocol implementation.
//!
//! This module provides high-performance ZeroMQ-compatible sockets built on `io_uring`.
//!
//! # Socket Types
//!
//! - [`DealerSocket`] - Asynchronous request-reply client (load-balanced)
//! - [`RouterSocket`] - Identity-based routing server
//! - [`ReqSocket`] - Synchronous request-reply client (strict alternation)
//! - [`RepSocket`] - Synchronous reply server (stateful envelope tracking)
//! - [`PubSocket`] - Publisher (broadcast to subscribers)
//! - [`SubSocket`] - Subscriber (receive filtered messages)
//! - [`PushSocket`] - Pipeline push (distribute tasks)
//! - [`PullSocket`] - Pipeline pull (receive tasks)
//! - [`PairSocket`] - Exclusive pair connection
//! - [`XPubSocket`] - Extended publisher (subscription events)
//! - [`XSubSocket`] - Extended subscriber (subscription forwarding)
//! - [`StreamSocket`] - Raw TCP bridging (no ZMTP handshake)
//!
//! # Features
//!
//! - **Endpoint Parsing**: Use `Endpoint::parse("tcp://...")` or `Endpoint::parse("ipc://...")`
//! - **Socket Monitoring**: Subscribe to connection events via `socket.monitor()`
//! - **IPC Transport**: Unix domain sockets for low-latency local communication (Unix only)
//!
//! # Quick Start
//!
//! ## DEALER (Client)
//!
//! ```rust,no_run
//! use monocoque::zmq::DealerSocket;
//! use bytes::Bytes;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let mut socket = DealerSocket::connect("127.0.0.1:5555").await?;
//! socket.send(vec![Bytes::from("REQUEST")]).await?;
//!
//! if let Ok(Some(reply)) = socket.recv().await {
//! println!("Got reply: {:?}", reply);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## ROUTER (Server)
//!
//! ```rust,no_run
//! use monocoque::zmq::RouterSocket;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let (listener, mut socket) = RouterSocket::bind("127.0.0.1:5555").await?;
//!
//! while let Ok(Some(msg)) = socket.recv().await {
//! socket.send(msg).await?; // Echo back
//! }
//! # Ok(())
//! # }
//! ```
// Re-export socket types
pub use DealerSocket;
pub use BufferConfig;
pub use ;
pub use ;
pub use SocketOptions;
pub use SocketType;
pub use ;
pub use proxy;
pub use ;
pub use PubSocket;
pub use PullSocket;
pub use PushSocket;
pub use RepSocket;
pub use ReqSocket;
pub use RouterSocket;
pub use SubSocket;
pub use ipc;
/// Convenient imports for ZeroMQ protocol.
///
/// # Example
///
/// ```rust
/// use monocoque::zmq::prelude::*;
///
/// // Now you have:
/// // - DealerSocket, RouterSocket, ReqSocket, RepSocket
/// // - PubSocket, SubSocket, XPubSocket, XSubSocket
/// // - PushSocket, PullSocket, PairSocket
/// // - Bytes for zero-copy messages
/// // - BufferConfig, SocketOptions, SocketType for configuration
/// ```