There's a lot of flexibility in how you can arrange topics and
payloads to achieve something like this. For example, you can use
the rack number as part of the topic string, or put it in the
payload. I tend to use it in the topic, since that then gives a lot
of flexibility in message subscriptions. You can subscribe to
messages from all the racks, a single one, or any combination.
I tend to start at the top of the topic hierarchy by separating out
"commands", "data", "events", "alarms", etc. So, you could have
topics like:
commands/rack/<cmd>/<racknum>
events/rack/<evt>/<racknum>
I would thing that a rack waking up is an event. So, when rack #5
wakes up it would publish a message on topic:
events/rack/wakeup/5
The payload can be anything else that's helpful. A timestamp, maybe.
Does the rack keep an inventory of barcodes? Put them in the
payload, if you want.
The PC would then be subscribed to a wildcard topic to receive all
events:
events/#
It can then parse the topic string to figure out that it was a
wakeup event from #5, and send the command(s), like:
commands/rack/do_something/5
In this case, the payload would be any parameters required by the
"do_something" command.
The other question is what to do while the device is sleeping. For a
fairly local group of devices I would just connect on each wakeup
and disconnect before going back to sleep. The Client ID for each
device/rack can use the unique rack number as part of the ID, and
then you can create a persistent (non-clean) session, and get any
messages queued for the device while it was sleeping.
Frank