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
Use pip to make an installation.
$ pip3 install mqtt-randompub --user
There is also a Fedora package available.
$ sudo dnf -y install mqtt-randompub
For Nix or NixOS users is a package available. Keep in mind that the lastest releases might only be present in the unstable channel.
$ nix-env -iA nixos.mqtt-randompub
Get the files
Clone the mqtt-randompub repository.
git clone git@github.com:fabaff/mqtt-randompub.git
Use this option if you want to modify the code or contribute.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mqtt_randompub-0.5.1.tar.gz.
File metadata
- Download URL: mqtt_randompub-0.5.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7007438a7e36150a72e1f7535463daf2dc8e8049101af229096eaaf0ce5cbd14
|
|
| MD5 |
e247347a3d8f9311dd2b22cc6c1d851b
|
|
| BLAKE2b-256 |
edca9129ab91f19d40862c598764a1593ebf867441ed120269a78024d732c771
|
Provenance
The following attestation bundles were made for mqtt_randompub-0.5.1.tar.gz:
Publisher:
publish-to-pypi.yml on fabaff/mqtt-randompub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mqtt_randompub-0.5.1.tar.gz -
Subject digest:
7007438a7e36150a72e1f7535463daf2dc8e8049101af229096eaaf0ce5cbd14 - Sigstore transparency entry: 1257373844
- Sigstore integration time:
-
Permalink:
fabaff/mqtt-randompub@db03e5fdc5d4df0072f06cc4c0e3f8dcc43f7aa7 -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/fabaff
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@db03e5fdc5d4df0072f06cc4c0e3f8dcc43f7aa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mqtt_randompub-0.5.1-py2.py3-none-any.whl.
File metadata
- Download URL: mqtt_randompub-0.5.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
292364e285554ec77b54e6e8389a10ef6cd90e82ed16fc70fe78d45eb7843205
|
|
| MD5 |
267cc9b45faf55114022cfe8ecbda4a8
|
|
| BLAKE2b-256 |
343a86f63cd98ae151e18ec497f19c9d8c124e1e8756bbf3e351d5ec890ca1fd
|
Provenance
The following attestation bundles were made for mqtt_randompub-0.5.1-py2.py3-none-any.whl:
Publisher:
publish-to-pypi.yml on fabaff/mqtt-randompub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mqtt_randompub-0.5.1-py2.py3-none-any.whl -
Subject digest:
292364e285554ec77b54e6e8389a10ef6cd90e82ed16fc70fe78d45eb7843205 - Sigstore transparency entry: 1257374249
- Sigstore integration time:
-
Permalink:
fabaff/mqtt-randompub@db03e5fdc5d4df0072f06cc4c0e3f8dcc43f7aa7 -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/fabaff
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@db03e5fdc5d4df0072f06cc4c0e3f8dcc43f7aa7 -
Trigger Event:
release
-
Statement type: