Delete tx messages after time


I send messages via MQTT (“application/[applicationID]/device/[devEUI]/tx”) to a node (Class A). In case of the node isn’t in range, the message will not be sent down (and gets not deleted from the server).
Now, if I want to send another message (and the preveous one wasn’t sent), the new message will be thrown away.

Is there a possibility to clean all tx-messages? Perhaps after a defined time, if they were not sent?

You can use the following API method for this:

DELETE /api/devices/{dev_eui}/queue 

Note that when the previous message hasn’t been sent, flushing the queue and enqueuing a new message doesn’t help. It will stay in the queue like the first one. It only helps when you want to replace the first message with a different message.

Thanks that worked for me.

Another question: If I use a confirmed downlink message and the message is not received by the node, will the message stay in the queue?

No, you will get a negative acknowledgement (from LoRa App Server) and it is up to you what to do. Please note that keeping it in the queue could result in a deadlock. When the downlink was received by the device, but the ACK got lost, LoRa Server can retry to send it but it will be rejected by the device as the frame-counter did not increment.