简体   繁体   中英

How to identify a message size from device to IoT hub in azure when using AMQP protocol?

Currently we have a device connected to IoT hub instance. We need to measure a particular message size sent from device to IoT hub.

Message sent is in Microsoft.Azure.Devices.Client.Message format. It's like as below

Microsoft.Azure.Devices.Client.Message msg = new Microsoft.Azure.Devices.Client.Message(Encoding.UTF8.GetBytes(messageBody.ToString(Newtonsoft.Json.Formatting.None)));

How to measure the message size in Bytes?

A message size, be it any protocol (AMQP, MQTT, or HTTPS) cannot go beyond 256 KB for Device to Cloud messaging. For the calculation of daily quota for each pricing tier (other than free tier), messages are calculated in 4 KB size for each packet per second. If the size is bigger than 4 KB, a new message packet is created. These packets are counted against the pricing tier you had selected for your IoT hub. There can be stream of messages, but each message cannot go beyond 256 KB. In order to identify the message size, you can deploy the Stream Analytics. Refer to the below articles.

https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-define-outputs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM