AzureIoTHubClearQueue
- Last UpdatedOct 29, 2026
- 2 minute read
AzureIoTHubClearQueue clears a message queue in an Azure IoT Hub connection. See Notes for more information.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
AzureIoTHubClearQueue |
Internet of Things |
Synchronous |
No |
Supported |
Not supported |
Not supported |
Supported |
Supported |
Syntax
AzureIoTHubClearQueue(strAlias)
strAlias
The name of the Azure IoT Hub connection that you want to use. The connection can be created either during project development (in the Project ExplorerTasks tab Internet of Things folder) or during project run time (by calling the AzureIoTHubOpen function).
Return value
If successful, this function returns 0 (zero).
If unsuccessful, this function returns one of the following negative integer values:
|
Value |
Description |
|---|---|
|
-300 |
Invalid alias detected by server |
|
-301 |
Invalid connection parameter |
|
-302 |
Invalid message parameter |
|
-303 |
Invalid type parameter |
|
-304 |
Invalid property parameter |
|
-305 |
Invalid message ID parameter |
|
-306 |
Connection has not been defined |
|
-307 |
Conflicting alias |
|
-308 |
Open connection error |
|
-309 |
Invalid command |
|
-310 |
Communication error |
|
-311 |
Invalid parameter index |
Notes
Messages are kept in the Gateway ("alive" in the IoT Hub queue) for up to 10 minutes before they are deleted from the queue. (The settings for messages are currently configured in the IoT Hub settings.) The Gateway has a limit of 100 messages per connection; older messages (in terms of creation time) will be deleted to make room for newer messages.
This function requires an open IoT Hub connection. The connection can be created either during project development (in the Project ExplorerTasks tab Internet of Things folder) or during project run time (by calling the AzureIoTHubOpen or AzureIoTHubSendMsg functions).
A message that has been deleted from the queue may come back into the queue if an event message is received from the IoT Hub. Even after AzureIoTHubClearQueue function is called, the messages may come back into the queue if they are still alive in the IoT Hub and the status changes.
Examples
As used in a Math worksheet:
|
Tag Name |
Expression |
|---|---|
|
nErr |
AzureIoTHubClearQueue("C1") |
|
nErr |
AzureIoTHubClearQueue("Test") |