Uplink delivery assurance

I’m trying to configure things so I have assurance than any uplinks that reach my gateways from my devices are guaranteed to reach my end integration service. I’m trying to ensure that nothing can be lost anywhere in the stack, regardless of downtime (not including the GW, obviously), restarts, etc, etc.

I have a gateway bridge on my gateways using MQTT, set to QoS 1. On my server, I am using the rabbitMQ-MQTT plugin, which is converting these uplinks to persistent messages in RabbitMQ. This seems to be working fine and nothing is lost during restarts etc.

Next, the network server consumes messages from RabbitMQ and sends the uplink to the application server. If the application server fails to process the uplink (e.g. external service down), the message is lost. Is there a way I can configure it so it only removes it from the queue when I acknowledge it is safe to do so? Could I do this if I revert back to MQTT?

Next, I have made a small change to amqp.go in the application server to make uplinks queued to the amqp integration persist (note this is not the same as a durable queue, which alone will not preserve queued messages during a restart):

			ContentType: contentType,
			DeliveryMode: 2, // delivery mode 2 makes messages persistent
			Body:        b,

I’ve also found that if the RabbitMQ service is restarted, the application server appears to reconnect when it comes back up, but it loses the ability to publish messages unless I also restart the application server. That is irrespective of the above code change.

I’m currently testing all of this on a single server, except the gateway bridge, which is on the gateway

I would be very grateful for any advice on this topic, or to hear from anyone who is or has attempted the same.