Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT Agent - add publish with RETAIN flag as option #3075

Open
kg333 opened this issue Feb 5, 2022 · 0 comments
Open

MQTT Agent - add publish with RETAIN flag as option #3075

kg333 opened this issue Feb 5, 2022 · 0 comments

Comments

@kg333
Copy link

kg333 commented Feb 5, 2022

The MQTT Agent currently appears to have no support for publishing messages with MQTT's RETAIN flag feature, which directs the MQTT broker to keep a copy of the last message for new subscribers to a topic.

ruby-mqtt does support RETAIN by sending an additional argument to the MQTT::Client#publish function, and editing mqtt_agent.rb to force RETAIN does appear to work for my use case:

c.publish(interpolated(event)['topic'], event.payload['message'])

 c.publish(interpolated(event)['topic'], event.payload['message'], retain=true) 

I suspect not everyone would be content with every MQTT agent publishing only with RETAIN, so this issue is to suggest adding a configuration option on an agent-by-agent basis. Based on some of the discussion in #1289, this may not be as simple since there's complications due to MQTT QoS level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant