pub struct MqttBroker { /* private fields */ }Expand description
MQTT broker implementation
Implementations§
Source§impl MqttBroker
impl MqttBroker
pub fn new(config: MqttConfig, _spec_registry: Arc<MqttSpecRegistry>) -> Self
Sourcepub async fn client_connect(
&self,
client_id: &str,
clean_session: bool,
) -> Result<(), Box<dyn Error>>
pub async fn client_connect( &self, client_id: &str, clean_session: bool, ) -> Result<(), Box<dyn Error>>
Handle client connection with session management
Sourcepub async fn client_disconnect(
&self,
client_id: &str,
) -> Result<(), Box<dyn Error>>
pub async fn client_disconnect( &self, client_id: &str, ) -> Result<(), Box<dyn Error>>
Handle client disconnection with session persistence
Sourcepub async fn client_subscribe(
&self,
client_id: &str,
topics: Vec<(String, u8)>,
) -> Result<(), Box<dyn Error>>
pub async fn client_subscribe( &self, client_id: &str, topics: Vec<(String, u8)>, ) -> Result<(), Box<dyn Error>>
Subscribe client to topics with session persistence
Sourcepub async fn client_unsubscribe(
&self,
client_id: &str,
filters: Vec<String>,
) -> Result<(), Box<dyn Error>>
pub async fn client_unsubscribe( &self, client_id: &str, filters: Vec<String>, ) -> Result<(), Box<dyn Error>>
Unsubscribe client from topics
Sourcepub fn config(&self) -> &MqttConfig
pub fn config(&self) -> &MqttConfig
Get broker configuration (for testing)
Sourcepub async fn get_active_topics(&self) -> Vec<String>
pub async fn get_active_topics(&self) -> Vec<String>
Get list of active topics (subscription filters and retained topics)
Sourcepub async fn get_connected_clients(&self) -> Vec<String>
pub async fn get_connected_clients(&self) -> Vec<String>
Get list of connected clients
Sourcepub async fn get_client_info(&self, client_id: &str) -> Option<ClientSession>
pub async fn get_client_info(&self, client_id: &str) -> Option<ClientSession>
Get client information
Sourcepub async fn disconnect_client(
&self,
client_id: &str,
) -> Result<(), Box<dyn Error>>
pub async fn disconnect_client( &self, client_id: &str, ) -> Result<(), Box<dyn Error>>
Disconnect a client
Sourcepub async fn get_topic_stats(&self) -> TopicStats
pub async fn get_topic_stats(&self) -> TopicStats
Get topic statistics
Sourcepub async fn next_packet_id(&self) -> u16
pub async fn next_packet_id(&self) -> u16
Generate next packet ID
pub async fn handle_publish( &self, client_id: &str, topic: &str, payload: Vec<u8>, qos: u8, retain: bool, ) -> Result<(), Box<dyn Error>>
Sourcepub async fn publish_with_qos(
&self,
client_id: &str,
topic: &str,
payload: Vec<u8>,
qos: u8,
retain: bool,
) -> Result<(), Box<dyn Error>>
pub async fn publish_with_qos( &self, client_id: &str, topic: &str, payload: Vec<u8>, qos: u8, retain: bool, ) -> Result<(), Box<dyn Error>>
Publish a message with QoS handling but skip fixture lookup (used for fixture responses)
Sourcepub async fn update_metrics(&self)
pub async fn update_metrics(&self)
Update Prometheus metrics with current broker statistics
Auto Trait Implementations§
impl Freeze for MqttBroker
impl !RefUnwindSafe for MqttBroker
impl Send for MqttBroker
impl Sync for MqttBroker
impl Unpin for MqttBroker
impl !UnwindSafe for MqttBroker
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more