Search code examples
eclipsemosquitto

How to send messages in Last In First Out (LIFO) manner with Mosquitto MQTT broker?


I am using Mosquitto broker and bridging with another one. I am following https://eclipse.org/mosquitto/man/mosquitto-conf-5.php this manual for configuration.

While connection lost Mosquitto broker is persisting data in file and when connection is back Mosquitto bridge will send messages as FIFO manner. (This is what i understood, please correct me if i am wrong)

I want it in LIFO, is there any way to tackle this ?

I did not find any configuration parameter for this. The following is an example of broker configuration which i am using.

# =================================================================
# Bridges
# =================================================================

connection MyMQTTBridge
address 192.168.2.138:1885
topic MyTopic out 0
topic MyTopic2 out 0
clientid MyBridgeClient
start_type automatic
username myMQTTAccount
password myMQTTPassword

# -----------------------------------------------------------------
# Certificate based SSL/TLS support
# -----------------------------------------------------------------

bridge_cafile /etc/mosquitto/cacert.crt

Solution

  • The MQTT protocol expects that messages are sent in the order that they were received, so reversing the order isn't something that is supported in mosquitto.