Azure IoT Java SDK: How to send batch device to cloud messages

Palnati, Venkata S 1 Reputation point
2020-07-16T23:01:44.79+00:00

Currently i am able to send one telemetry message at a time from device to azure IoT but i didn't find any option to send batch of messages in java SDK. can anyone help me here how can we send batch messages using java SDK.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,124 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 27,646 Reputation points
    2020-07-17T06:27:36.943+00:00

    @PalnatiVenkataS-5334 Welcome to Q&A forum!

    You can use HttpsBatchMessage class which builds a batched IoT Hub request body as a JSON array and sent to IoT Hub. The batched message has a maximum size of 256 kb.

    As mentioned, Device-to-cloud messages can be at most 256 KB, and can be grouped in batches to optimize sends. Batches can be at most 256 KB.

    IoT Hub only supports batch send over AMQP and HTTPS only at the moment. The SDK supports batch send over HTTP. * Batch send over AMQP and AMQP-WS, and add system properties on D2C messages are in progress.

    See Microsoft Azure IoT SDKs for Java to understand more about Azure IoT SDKs for Java.