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
// Enforce memory safety across the entire crate
// Allow deeper recursion for complex macros
//! RMQTT Broker Core Implementation (v2025.04)
//!
//! Implements high-performance MQTT broker architecture with full protocol compliance (v3.1.1 & v5.0),
//! designed for mission-critical IoT systems and large-scale distributed deployments. Key features:
//!
//! 1. **Protocol Engine**
//! - Dual-stack MQTT v3/v5 support via `v3`/`v5` modules
//! - Zero-copy codec implementation from `rmqtt_codec`
//! - QoS 0/1/2 message handling with `inflight` tracking
//!
//!
//! 2. **Enterprise Features**
//! - Distributed session management via `shared` module
//! - Cluster node coordination in `node` module
//! - TLS/SSL support with certificate validation
//! - Retained message store (`retain` feature)
//!
//! 3. **Extensibility**
//! - Plugin system architecture (`plugin` module)
//! - Custom authentication hooks (`acl` module)
//! - Metrics collection pipeline (`metrics` feature)
//!
//!
//! [MQTT Spec Compliance](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html)
//!
//! # Overall Example
//! ```rust,no_run
//!
//! use rmqtt::context::ServerContext;
//! use rmqtt::net::{Builder, Result};
//! use rmqtt::server::MqttServer;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//!
//! let scx = ServerContext::new().build().await;
//!
//! MqttServer::new(scx)
//! .listener(Builder::new().name("external/tcp").laddr(([0, 0, 0, 0], 1883).into()).bind()?.tcp()?)
//! .listener(Builder::new().name("internal/tcp").laddr(([0, 0, 0, 0], 11883).into()).bind()?.tcp()?)
//! .listener(Builder::new().name("external/ws").laddr(([0, 0, 0, 0], 8080).into()).bind()?.ws()?)
//! .build()
//! .run()
//! .await?;
//! Ok(())
//! }
//!
//! ```
// Access Control List management
// Command-line argument parsing
// Shared execution context
// Feature-gated Modules
// Delayed message publishing
// gRPC API integration
// Message storage subsystem
// Metrics collection and reporting
// Plugin system infrastructure
// Retained message handling
// Runtime statistics tracking
// Essential Services
// Async task executor
// Extension points
// Message fitting strategies
// Event hook system
// In-flight message tracking
// Cluster node management
// Message queue implementation
// Message routing core
// Server lifecycle management
// Client session handling
// Shared state management
// Subscription Management
// Subscription services
// Topic Handling
// Topic parsing and validation
// Topic trie structure
// Protocol Support
// Common data types
// MQTT v3.1.1 implementation
// MQTT v5.0 implementation
/// External Crate Re-exports
pub use ; // Network error types
/// Feature-gated Re-exports
pub use rmqtt_codec as codec; // MQTT protocol codec
// Macro utilities
pub use rmqtt_macros as macros;
pub use rmqtt_net as net; // Network abstractions
pub use rmqtt_utils as utils; // Common utilities