Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Bridge to AWS IoT and retain flag

The client that publishes the message sets the retain bit.  i.e. the client sends a message and tells the broker that it expects that message to stay until something changes or deletes it.  There's usually a significant semantic meaning between a message that has retention and one that doesn't.  (Though expiry blurs this a bit).

I don't use mosquitto, but when I did, I also didn't use its bridge since I wanted bridging features it didn't have and I ended up writing my own one afternoon.  It wouldn't be terribly hard to get my bridge to drop retention (or perform other manipulation).  That starts to drift a bit from the general purpose of a bridge, but would be within the spirit of such a thing.  The first functioning version of my bridge (v5 <-> v5) was around 200 lines of code (half of that was the parser for the configuration language I made for it).  It's up to almost 270 now, but supports multiway bridges and some basic rewriting.  I've not looked at it in a year, but it looks like it'd be pretty easy to bridge with retention stripped.

This is pretty far from what you're looking for, but I've also written most of my own mqtt clients, and broker as well.  My clothes are all woven from the finest yak.

On Thu, Oct 22, 2020 at 11:29 PM Thomas Meier <tfmeier@xxxxxxxxx> wrote:
I hear you and retain might as well be a critical feature for some applications. In my case it's a home automation environment in its early stages and maybe I come to a point where this becomes a non-negotiable requirement.

What I want to understand is whether there is a way to send messages with retain=off and where this is set. Say I have a device running Tasmota with MQTT enabled. In the Tasmota config I specify the MQTT broker (Mosquitto) and have a bridge configured (Mosquitto <--> AWS IoT). If I wanted to forward the state of a switch connected to the Tasmota device to the AWS IoT broker (via the bridge) is the setting for retain=off 1) in the Tasmota device (i.e. the client) or b) the local broker (i.e. Mosquitto)? I was hoping b) as I understand in a bridge configuration the Mosquitto MQTT broker becomes an MQTT client.

On Fri, Oct 23, 2020 at 4:35 PM Dustin Sallings <dustin@xxxxxxx> wrote:
retain is a rather important feature and if a client is expecting it to work, then disconnecting the client is going to be bad.

IMO, if a broker doesn't support retain, it's not worth trying to deal with it.  Both Google and AWS mqtt brokers provide such a small fraction of the features of MQTT that I found it better to just run my own mqtt broker in the cloud.

On Thu, Oct 22, 2020 at 9:29 PM Thomas Meier <tfmeier@xxxxxxxxx> wrote:
I'm trying to create an MQTT bridge from my Mosquitto broker running inside Home Assistant to the AWS IoT broker.

As far as I can tell the bridge is setup properly as I can test communication in both directions (followed this guide https://aws.amazon.com/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/).

However it appears that MQTT messages sent from Home Assistant have retain=yes. Reading on AWS IoT I understand the retain flag is not supported and any client sending message with retain=yes get disconnected.

Assuming this is correct I need to find a way to globally disable retain on the Mosquitto end, right? Reading the mosquitto.conf man page the option retain_available [ true | false ] doesn't seem to help.

Is there a way to globally disable retain?

Thomas
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev

Back to the top