Newbie MQTT structure question


I am just getting started with MQTT. I have an embedded system which I am going to add an MQTT Client to, and then I will start working with the MQTT Broker.

I would like to describe the project I am working on, to hopefully get some feedback on the direction of the MQTT set up.

I apologize in advance. I am in the state of not knowing what I don’t know, so I may well be talking MQTT nonsense in the following.

Project Description

We would have a few thousand kiosks in the field
A user can buy a voucher online / in a store, enter the voucher number at the kiosk, and use a service that one time. The number of use-once vouchers would be in the hundreds of thousands. Each voucher would have a unique(say) 16-digit number.
When the voucher number is entered, the kiosk needs to verify (with a remote server) that the voucher number is valid, then provide a service to the user, then notify the remote server of the final voucher status (e.g. “used”).
When receiving the voucher verification request, and the voucher final status, the remote server would also want to know the kiosk ID, location, time/date and some other data.


I am trying to figure out how the topics and messaging would be structured.
One way might be for each kiosk to create and publish a topic about itself (id, location etc.), and the remote server to subscribe to all kiosk topics. When a user enters a voucher, the kiosk could create and publish another topic about the voucher – e.g. my_project/kiosk_num/voucher_num?
But I was wondering if each voucher number could be a topic. Each kiosk could create a topic about itself, so that the remote server knows the status of the kiosks. But a kiosk could also create and publish a new voucher topic (e.g. my_project/voucher_num), when a new voucher number is entered. The remote server would subscribe to all (possible) voucher topics.

Thanks for reading this. Any feedback / pointers would be greatly appreciated.

Hi Garrett,

What you are describing sounds like an excellent use case for MQTT. :slight_smile:

About your topic structures, there is no absolute right or wrong. It has to fit your administrative needs.
As you described, you can even publish on two different topics at the same time from the same kiosk.
Take into account that you might also want to administer the different kiosks in terms of ACLs. So they can only publish to the topics you need them to.

If you have more detailed questions, let me know. :slight_smile: