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.:
sudo python-pip install mqtt-randompub
Dependencies
mqtt-randompub depends only on paho-mqtt . This module should be pulled in automatically when installed with pip.
On a Fedora system:
sudo yum -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.
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 Distributions
Built Distributions
File details
Details for the file mqtt_randompub-0.2.0-py3.4.egg
.
File metadata
- Download URL: mqtt_randompub-0.2.0-py3.4.egg
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fb380161e348a971f681fd2d5e6f632579f114957b8cfa927180d73b0c34725 |
|
MD5 | f73896d063ba8225015cacd6d1130faa |
|
BLAKE2b-256 | 0bc16f0ffef17a97e9b340f05e1ac3e5c37ef78254d448f598fd65ee4e78f875 |
File details
Details for the file mqtt_randompub-0.2.0-py2.7.egg
.
File metadata
- Download URL: mqtt_randompub-0.2.0-py2.7.egg
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4232121e4e61f2c6d3e75f7fb2f02c60131f6c4df07f45c59139f3c4361fd82b |
|
MD5 | b1be1607a12db67d61241929f93ee8ae |
|
BLAKE2b-256 | 5b42389a804fe7e742f9755621577a58be1c73e911a46fc4f468adc52f8d374a |