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!
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.