Search code examples
azure-iot-hubazure-iot-sdk

Azure IoT on Edge - IoTSDK - Read batch of messages from ModuleClient


I'm tryng to develop an high-frequency message dispatching application and i'm observing for the behavior of the SDK about message reading from the ModuleClient connected to the edgeHub by using "MQTT on TCP Only" transport settings.

Seems that there is no way to read multiple messages at time (batch) from the edgeHub (I think is something related to the underlying protocol). So the result is that one must sequentially read a message, process it and give the ack to the hub.

Does exist a way to process multiple message at time without waiting for the processing of the previous? Is this "limitation" tied to the underlyng protocol?

I'm using Microsoft.Azure.Devices.Client 1.37.2 on a .NET Core 3.1 application deployed on Azure Kubernetes (AKS) by using Azure IoT Edge on Kubernetes workload.


Solution

  • You are correct, you cannot use batch in MQTT protocol. This is a limitation tied to IoTHub when using MQTT Protocol.

    IoT Hub only supports batch send over AMQP and HTTPS at the moment. The MQTT implementation loops over the batch and sends each message individually.

    Ref: https://github.com/Azure/azure-iot-sdk-csharp

    Suggest that you add a new feature request, if need IoTHub to support batch when connecting using MQTT: https://feedback.azure.com/forums/321918-azure-iot-hub-dps-sdks