Crate rmqtt

Source
Expand description

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

§Overall Example


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(())
}

Re-exports§

pub use rmqtt_codec as codec;
pub use rmqtt_macros as macros;
pub use rmqtt_net as net;
pub use rmqtt_utils as utils;

Modules§

acl
MQTT Access Control List (ACL) Implementation
args
context
MQTT Server Runtime Context Management
delayed
Delayed Message Publishing System
executor
Handshake Connection Management System
extend
MQTT Broker Core Management System
fitter
MQTT Connection Parameter Management
grpc
Distributed MQTT Broker gRPC Communication Layer
hook
MQTT Broker Plugin Hook System
inflight
MQTT Inflight Message Management System
message
MQTT Message Storage and Retrieval System
metrics
MQTT Broker Performance Monitoring System
node
MQTT Broker Node Management Core
plugin
MQTT Broker Plugin Management System
queue
A bounded asynchronous channel with rate-limiting and customizable backpressure policies.
retain
MQTT Retained Message Storage Implementation
router
MQTT Topic Routing & Subscription Management Core
server
MQTT Server Implementation Core
session
MQTT Session Management Core
shared
MQTT Session Management & Message Routing Core
stats
MQTT Broker Performance Monitoring
subscribe
MQTT Subscription Management Core
topic
MQTT Topic Handling Module
trie
MQTT Topic Tree Implementation with Wildcard Support
types
Some commonly used type definitions
v3
MQTT v3.1.1 Protocol Connection Handler
v5
MQTT v5 Protocol Connection Handler Implementation

Macros§

register
topic

Type Aliases§

Error
External Crate Re-exports Convenience type alias for generic errors
Result
External Crate Re-exports Result type alias using crate’s Error type