Skip to main content
4-Participant
February 14, 2025
Solved

Retaining messages on MQTT Publish in Kepware IoT Gateway

  • February 14, 2025
  • 1 reply
  • 458 views

How to add retain flag in Kepware publish so that the MQTT broker can retain messages from Kepware? Is there any other approach so that message can be retained in MQTT broker when sent via IoT gateway?

Best answer by bmacri

Greetings.  There is no way to set messages to be retained in a MQTT Agent at this time,  I would be interested to understand the use case for why it is a need for you.

 

A MQTT broker only retains the last update sent to a topic and a retained message is only sent when a client first subscribes to a topic.  Assuming that the publishing interval on the IoT Gateway Agent is fairly quick, the amount of time that a client would get the retained message before getting the next message is limited.

 

Adding the ability to publish messages with the retain flag is a small enhancement but I would be interested to understand how it would be used.

 

Thanks!

-Ben Macri

1 reply

bmacri12-AmethystAnswer
12-Amethyst
February 16, 2025

Greetings.  There is no way to set messages to be retained in a MQTT Agent at this time,  I would be interested to understand the use case for why it is a need for you.

 

A MQTT broker only retains the last update sent to a topic and a retained message is only sent when a client first subscribes to a topic.  Assuming that the publishing interval on the IoT Gateway Agent is fairly quick, the amount of time that a client would get the retained message before getting the next message is limited.

 

Adding the ability to publish messages with the retain flag is a small enhancement but I would be interested to understand how it would be used.

 

Thanks!

-Ben Macri