Documentation

Python Rust

Community Module

These modules are maintained by the community, outside of the Testcontainers project.

Description

Eclipse Mosquitto is an open source message broker which implements MQTT version 5, 3.1.1 and 3.1.

Examples

Dependency:
pip install testcontainers[mqtt]
Usage:
with MosquittoContainer(image = "eclipse-mosquitto:2.0.20") as mosquitto_broker:
    mqtt_client = mosquitto_broker.get_client()
Dependency:
cargo add -F mosquitto --dev testcontainers-modules
Usage:
testcontainers_modules::mosquitto::Mosquitto::default().start()

let broker_url = format!(
    "{}:{}",
    mosquitto_instance.get_host().unwrap(),
    mosquitto_instance.get_host_port_ipv4(1883).unwrap()
);