Tool for generating MQTT messages on various topics
Project description
For testing application and tools which are handling MQTT messages it’s often needed to send continuously messages on random topics to a broker. mqtt-randompub contains options to send a single message, a specific count of messages, or a constant flow of messages till the tool is terminated. Configuration files can be used to store lists of topics to create repeatable test scenarios.
Prerequisites/Installation
Get the files
Clone the mqtt-randompub repository:
git clone git@github.com:fabaff/mqtt-randompub.git
or use pip to make an installation.:
pip3 install mqtt-randompub --user
Dependencies
mqtt-randompub depends only on paho-mqtt . This module should be pulled in automatically when installed with pip.
On a Fedora system:
sudo dnf -y install python-paho-mqtt
Usage
To run mqtt-randompub just type:
$ mqtt-randompub -h usage: mqtt-randompub [-h] [-c CONFIG] [-b BROKER] [-p PORT] [-q QOS] [-t TOPIC] [-s SUBTOPIC1] [-d SUBTOPIC2] [-l LOAD] [-i INTERVAL] [-n NUMBER] optional arguments: -h, --help show this help message and exit -c CONFIG, --config CONFIG configuration file to use -b BROKER, --broker BROKER set the broker -p PORT, --port PORT set the proker port -q QOS, --qos QOS set the QoS of the messages -t TOPIC, --topic TOPIC set the main topic -s SUBTOPIC1, --subtopic1 SUBTOPIC1 set the first subtopic -d SUBTOPIC2, --subtopic2 SUBTOPIC2 set the second subtopic -l LOAD, --load LOAD what to use as message payload -i INTERVAL, --interval INTERVAL time in seconds between the messages -n NUMBER, --number NUMBER number of messages to send. set to 0 for running
in a terminal to see all options. Running without any option will send a sample message to test/# to a broker which listens on localhost on port 1883.
For local testing run a MQTT broker/server on localhost.
mosca - A multi-transport MQTT broker for node.js (no longer maintained)
mosquitto - An Open Source MQTT v3.1 Broker
and subscribe to the topic test/# with a MQTT client. For example:
mosquitto_sub -h localhost -d -t test/#
You can run mqtt-randompub with a configuration file to re-use a previous set of topics. Check the mqtt-randompub.example file for details.
License
mqtt-randompub licensed under MIT, for more details check LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mqtt-randompub-0.2.2.tar.gz
.
File metadata
- Download URL: mqtt-randompub-0.2.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24a3e4c3ecaeaab72949ad60077ba59a824147763c0789b74df04bf9fe1e8d1f |
|
MD5 | df2e163d233c4663ca42cb03b90a4f30 |
|
BLAKE2b-256 | 26ac1cccd285d507dced7e01e8836a6997c84a8d5f5b0dd26fa64396fa1cca49 |
Provenance
File details
Details for the file mqtt_randompub-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: mqtt_randompub-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1625c1f272bd24e701ac786bf8e9cdb3962aa68cf381aa216c280137661522 |
|
MD5 | a1545e54177823df414df9488bd27ca9 |
|
BLAKE2b-256 | bf0ac11a502d6d0a1b0c8e68538cc5f9825831c151c2e88e668ae86c8b6babe6 |