2

I'm working on my first MQTT data collection project, and I need to write all the messages into one text file for later analysis. I do a little embedded programming in C, but I haven't written software to run on a PC in years. Where should I start? Will I need to write code (or maybe there something available that will do this? I don't really need much UI, other than something to indicate progress. It'll be about 500k messages. (Mercifully, they don't have to be written to the file at any certain speed.) This is a proof of concept project, so we'll be using a free broker, not sure which one yet. Right now the only (known) broker requirement is the ability to run it locally, rather than across the internet. I hope I'm not duplicating here. Any advice appreciated!

1 Answer 1

3

It appears that for this purpose, you shouldn't have to write code. You should be able to use an existing program that you can use to connect to the broker, subscribe to the topics of your choice and log the messages you get.

One such MQTT client: https://github.com/hivemq/mqtt-cli

See that the -of option will write to a file. See https://hivemq.github.io/mqtt-cli/docs/subscribe/

For example, if AWS IoT is the chosen broker, see this to get an idea of what to do: https://aws.amazon.com/blogs/iot/use-aws-iot-core-mqtt-broker-with-standard-mqtt-libraries/

There's also other client programs such as open source mosquitto and closed source https://mqttx.app/ There's even online ones so you dont have to run anything on your pc such as http://www.emqx.io/online-mqtt-client#/recent_connections

And there's even ones you can run in your browser such as https://mqttx.app/web

Let us know what you did and how it went.

1
  • kalyanswaroop, Thanks so much for that, I'll start out with the hivemq option - it looks like the documentation will be adequate to get started. I've had to put this part of the project on hold, and address some other issues. Before that happened, though, I installed Peakboard Designer, which does have a viewer option, so you can see messages in a GUI as they arrive. In any case, thanks so much for providing several good suggestions. I'll comment back on where we go next.
    – PhysicsGuy
    Commented Feb 21 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.