Back to Documentation Index
MQTTClientPublisher stores the parameters and data of an MQTT PUBLISH command sent from a client. The same functionality can be obtained by calling the Publish method of a TMQTTClient object. This component stores the parameters for such a command in the application's resource file as a convenience.
| Name | Visibility | Access | Description |
|---|
| Enabled | published | RW | Determines whether this publisher is Enabled. Default is true. If set to false the Publish method won't publish the message or trigger the OnPublish event. |
| AutoPublish | published | RW | Boolean value. If set to true, any change to the Data property will cause the component to call Publish. Default false. |
| Client | published | RW | The TMQTTClient components used for publishing data. This property is required or the component will not be able to send messages to the server. When the Client property is changed, it adds/removes the object from the corresponding TMQTTClient.Publishers lists. |
| Topic | published | RW | A UTF-8 String representing the topic to publish to. Internally stored by a TMQTTTokenizer object that enforces some validity constraints on the Topic. |
| Data | published | RW | A text string containing the data to be sent to the server. If the AutoPublish property is true, then setting the Data property will cause the Publish command to execute but only if the Data has changed. |
| QOS | published | RW | A TMQTTQOSType (qtAT_MOST_ONCE, qtAT_LEAST_ONCE, qtEXACTLY_ONCE). These correspond to QOS0, QOS1, and QOS2. Determines the quality of service used to deliver the message to the server. See the MQTT specs for more info. The default is qtAT_LEAST_ONCE (QOS1). |
| Retain | published | RW | Whether the published message should be retained by the server. Any client subscribing to a topic will recieve any matching retained messages that match the topic filter. |
| Modified | public | RW | This property is set to true whenever any of the properties of the component are changed. Used for updating GUI displays or data stores. Set it to false in code to reset the flag. |
| Name | Visibility | Description |
|---|
| Create | public | Creates the component and sets its default values |
| Destroy | public | Destroys the component and removes it from the Client's Publishers list if the Client property has been assigned. |
| Publish | public | Calls the Publish command of Client, passing the properties of this component as parameters to this command |
| Clear | public | Clears the properties of data and resets it to default values. After a call to Clear, the component will be in almost the same state it was as when it was created. The Client property is NOT cleared. The Modified property is set to false. |
| Changed | protected | Virtual method that can be overridden. In this class this method calls the OnChanged event handler. |
| Assign | public | Assign the properties and events from another object of class TMQTTClientPublisher |
| Name | Description |
|---|
| OnChanged | A TNotifyEvent that is called whenever any of the properties of the component are changed. Intended for notifying GUI displays or data stores about updates. |
| OnPublish | A TNotifyEvent that is called right before the Publish command is sent. Provides a means for applications to modify the properties of the command or enforce constraints before it is sent. Raise an EAbort exception to prevent the publishing of the message. If can also be used to provide an alternative means of publishing a message when the Client property is nil. |