FB_IotMqttMessageQueue
This function block provides a message queue for MQTT messages, which can be used with the FB_IotMqttClient function block. To this end an instance is declared and transferred at the input of FB_IotMqttClient. The function block operates based on the first in, first out principle (FIFO). It is possible that multiple MQTT messages are received within one PLC cycle and made available at the message queue.
During the program sequence, the property nQueuedMessages
can be used to check whether and how many messages have been collected in the message queue. The Dequeue()
method is used for removing messages from the FIFO queue. The oldest message is output first.
![]() | Size of the MQTT message queue The maximum number of possible messages in the queue can be set via the parameter The MQTT message queue allocates new memory space for new messages according to the topic and payload size. By default the maximum size of a message is limited to 100 kB, the size of the MQTT message queue is limited to 1000 kB. For special cases these values can also be adjusted in the parameter list. |
Properties
Name | Type | Access | Description |
---|---|---|---|
bOverwriteOldestEntry | BOOL | Get, Set | Here you can parameterize whether, when the queue is full, a newly received message should overwrite the oldest message. If yes (TRUE), the oldest message is lost. If no (FALSE), the latest message is lost. A full queue is an unlikely case if the user ensures a speedy readout of the queue using the |
nQueuedMessages | UDINT | Get | Outputs the number of MQTT messages currently collected in the queue. |
Methods
Name | Description |
---|---|
Removes an MQTT message from the queue. | |
Deletes all messages from the queue. |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.4022.0 | IPC or CX (x86, x64, ARM) | Tc3_IotBase |