Skip to content

Commit 8a58d19

Browse files
committed
acrolinx and freshness
1 parent 20c4005 commit 8a58d19

File tree

2 files changed

+30
-32
lines changed

2 files changed

+30
-32
lines changed

articles/iot-hub/iot-hub-devguide-messages-construct.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
11
---
2-
title: Understand Azure IoT Hub message format
3-
description: This article describes the format and expected content of IoT Hub messages.
2+
title: Understand message format
3+
titleSuffix: Azure IoT Hub
4+
description: This article describes the format and expected content of IoT Hub messages for cloud-to-device and device-to-cloud messages.
45
author: kgremban
56

67
ms.service: iot-hub
78
ms.topic: concept-article
8-
ms.date: 2/7/2022
9+
ms.date: 08/22/2024
910
ms.author: kgremban
1011
ms.custom: ['Role: Cloud Development', 'Role: IoT Device']
1112
---
1213

1314
# Create and read IoT Hub messages
1415

15-
To support seamless interoperability across protocols, IoT Hub defines a common set of messaging features that are available in all device-facing protocols. These can be used in both [device-to-cloud message routing](iot-hub-devguide-messages-d2c.md) and [cloud-to-device messages](iot-hub-devguide-messages-c2d.md).
16+
To support interoperability across protocols, IoT Hub defines a common set of messaging features that are available in all device-facing protocols. These features can be used in both [device-to-cloud messages](iot-hub-devguide-messages-d2c.md) and [cloud-to-device messages](iot-hub-devguide-messages-c2d.md).
1617

1718
[!INCLUDE [iot-hub-basic](../../includes/iot-hub-basic-partial.md)]
1819

19-
IoT Hub implements device-to-cloud messaging using a streaming messaging pattern. IoT Hub's device-to-cloud messages are more like [Event Hubs](../event-hubs/index.yml) *events* than [Service Bus](../service-bus-messaging/index.yml) *messages* in that there is a high volume of events passing through the service that can be read by multiple readers.
20+
IoT Hub implements device-to-cloud messaging using a streaming messaging pattern. IoT Hub's device-to-cloud messages are more like [Event Hubs](../event-hubs/index.yml) *events* than [Service Bus](../service-bus-messaging/index.yml) *messages* in that there's a high volume of events passing through the service that multiple readers can read.
2021

2122
An IoT Hub message consists of:
2223

23-
* A predetermined set of *system properties* as listed below.
24+
* A predetermined set of *system properties* as described later in this article.
2425

2526
* A set of *application properties*. A dictionary of string properties that the application can define and access, without needing to deserialize the message body. IoT Hub never modifies these properties.
2627

2728
* A message body, which can be any type of data.
2829

29-
Each device protocol implements setting properties in different ways. Please see the related [MQTT](../iot/iot-mqtt-connect-to-iot-hub.md) and [AMQP](./iot-hub-amqp-support.md) developer guides for details.
30+
Each device protocol implements setting properties in different ways. For more information, see the [MQTT protocol guide](../iot/iot-mqtt-connect-to-iot-hub.md) and [AMQP protocol guide](./iot-hub-amqp-support.md) developer guides for details.
3031

31-
Property names and values can only contain ASCII alphanumeric characters, plus ``{'!', '#', '$', '%, '&', ''', '*', '+', '-', '.', '^', '_', '`', '|', '~'}`` when you send device-to-cloud messages using the HTTPS protocol or send cloud-to-device messages.
32+
When you send device-to-cloud messages using the HTTPS protocol or send cloud-to-device messages, property names and values can only contain ASCII alphanumeric characters, plus ``! # $ % & ' * + - . ^ _ ` | ~`` .
3233

3334
Device-to-cloud messaging with IoT Hub has the following characteristics:
3435

3536
* Device-to-cloud messages are durable and retained in an IoT hub's default **messages/events** endpoint for up to seven days.
3637

3738
* 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.
3839

39-
* IoT Hub does not allow arbitrary partitioning. Device-to-cloud messages are partitioned based on their originating **deviceId**.
40+
* IoT Hub doesn't allow arbitrary partitioning. Device-to-cloud messages are partitioned based on their originating **deviceId**.
4041

4142
* As explained in [Control access to IoT Hub](iot-hub-devguide-security.md), IoT Hub enables per-device authentication and access control.
4243

43-
* You can stamp messages with information that goes into the application properties. For more information, please see [message enrichments](iot-hub-message-enrichments-overview.md).
44-
45-
For more information about how to encode and decode messages sent using different protocols, see [Azure IoT SDKs](iot-hub-devguide-sdks.md).
44+
* You can stamp messages with information that goes into the application properties. For more information, see [message enrichments](iot-hub-message-enrichments-overview.md).
4645

4746
> [!NOTE]
48-
> Each IoT Hub protocol provides a message content type property which is respected when routing data to custom endpoints. To have your data properly handled at the destination (for example, JSON being treated as a parsable string instead of Base64 encoded binary data), you must provide the appropriate content type and charset for the message.
49-
>
47+
> Each IoT Hub protocol provides a message content type property which is respected when routing data to custom endpoints. To have your data properly handled at the destination (for example, JSON being treated as a parsable string instead of Base64 encoded binary data), provide the appropriate content type and charset for the message.
5048
51-
To use your message body in an IoT Hub routing query you must provide a valid JSON object for the message and set the content type property of the message to `application/json;charset=utf-8`.
49+
To use your message body in an IoT Hub routing query, provide a valid JSON object for the message and set the content type property of the message to `application/json;charset=utf-8`.
5250

53-
A valid, routable message body may look like the following:
51+
The following example shows a valid, routable message body:
5452

5553
```json
5654
{
@@ -60,13 +58,13 @@ A valid, routable message body may look like the following:
6058
}
6159
```
6260

63-
## System Properties of **D2C** IoT Hub messages
61+
## System properties of device-to-cloud messages
6462

6563
| Property | Description |User Settable?|Keyword for </br>routing query|
6664
| --- | --- | --- | --- |
67-
| message-id |A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters + `{'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}`. | Yes | messageId |
65+
| message-id |A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters plus `- : . + % _ # * ? ! ( ) , = @ ; $ '`. | Yes | messageId |
6866
| iothub-enqueuedtime |Date and time the [Device-to-Cloud](iot-hub-devguide-d2c-guidance.md) message was received by IoT Hub. | No | enqueuedTime |
69-
| user-id |An ID used to specify the origin of messages. When messages are generated by IoT Hub, it is set to `{iot hub name}`. | Yes | userId |
67+
| user-id |An ID used to specify the origin of messages. | Yes | userId |
7068
| iothub-connection-device-id |An ID set by IoT Hub on device-to-cloud messages. It contains the **deviceId** of the device that sent the message. | No | connectionDeviceId |
7169
| iothub-connection-module-id |An ID set by IoT Hub on device-to-cloud messages. It contains the **moduleId** of the device that sent the message. | No | connectionModuleId |
7270
| iothub-connection-auth-generation-id |An ID set by IoT Hub on device-to-cloud messages. It contains the **connectionDeviceGenerationId** (as per [Device identity properties](iot-hub-devguide-identity-registry.md#device-identity-properties)) of the device that sent the message. | No |connectionDeviceGenerationId |
@@ -76,9 +74,9 @@ A valid, routable message body may look like the following:
7674
| dt-dataschema | This value is set by IoT hub on device-to-cloud messages. It contains the device model ID set in the device connection. | No | $dt-dataschema |
7775
| dt-subject | The name of the component that is sending the device-to-cloud messages. | Yes | $dt-subject |
7876

79-
## Application Properties of **D2C** IoT Hub messages
77+
## Application properties of device-to-cloud messages
8078

81-
A common use of application properties is to send a timestamp from the device using the `iothub-creation-time-utc` property to record when the message was sent by the device. The format of this timestamp must be UTC with no timezone information. For example, `2021-04-21T11:30:16Z` is valid, `2021-04-21T11:30:16-07:00` is invalid:
79+
A common use of application properties is to send a timestamp from the device using the `iothub-creation-time-utc` property to record when the message was sent by the device. The format of this timestamp must be UTC with no timezone information. For example, `2021-04-21T11:30:16Z` is valid, but `2021-04-21T11:30:16-07:00` is invalid.
8280

8381
```json
8482
{
@@ -98,21 +96,21 @@ A common use of application properties is to send a timestamp from the device us
9896
}
9997
```
10098

101-
## System Properties of **C2D** IoT Hub messages
99+
## System properties of cloud-to-device messages
102100

103101
| Property | Description |User Settable?|
104102
| --- | --- | --- |
105-
| message-id |A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters + `{'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}`. |Yes|
103+
| message-id |A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters plus `- : . + % _ # * ? ! ( ) , = @ ; $ '`. |Yes|
106104
| sequence-number |A number (unique per device-queue) assigned by IoT Hub to each cloud-to-device message. |No|
107105
| to |A destination specified in [Cloud-to-Device](iot-hub-devguide-c2d-guidance.md) messages. |No|
108106
| absolute-expiry-time |Date and time of message expiration. |Yes|
109107
| correlation-id |A string property in a response message that typically contains the MessageId of the request, in request-reply patterns. |Yes|
110-
| user-id |An ID used to specify the origin of messages. When messages are generated by IoT Hub, it is set to `{iot hub name}`. |Yes|
108+
| user-id |An ID used to specify the origin of messages. When messages are generated by IoT Hub, the user ID is the IoT hub name. |Yes|
111109
| iothub-ack |A feedback message generator. This property is used in cloud-to-device messages to request IoT Hub to generate feedback messages as a result of the consumption of the message by the device. Possible values: **none** (default): no feedback message is generated, **positive**: receive a feedback message if the message was completed, **negative**: receive a feedback message if the message expired (or maximum delivery count was reached) without being completed by the device, or **full**: both positive and negative. |Yes|
112110

113-
### System Property Names
111+
### System property names
114112

115-
The system property names vary based on the endpoint to which the messages are being routed. Please see the table below for details on these names.
113+
The system property names vary based on the endpoint to which the messages are being routed.
116114

117115
|System property name|Event Hubs|Azure Storage|Service Bus|Event Grid|
118116
|--------------------|----------|-------------|-----------|----------|

articles/iot-hub/iot-hub-non-telemetry-event-schema.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services: iot-hub
1111

1212
# Azure IoT Hub non-telemetry event schemas
1313

14-
This article provides the properties and schemas for non-telemetry events emitted by Azure IoT Hub. Non-telemetry events are different from device-to-cloud and cloud-to-device messages in that they are emitted directly by IoT Hub in response to specific kinds of state changes associated with your devices. For example, lifecycle changes like a device or module being created or deleted, or connection state changes like a device or module connecting or disconnecting.
14+
This article provides the properties and schemas for non-telemetry events emitted by Azure IoT Hub. Non-telemetry events are different from device-to-cloud and cloud-to-device messages in that IoT Hub emits these events in response to specific state changes associated with your devices. For example, lifecycle changes like a device or module being created or deleted, or connection state changes like a device or module connecting or disconnecting.
1515

1616
You can route non-telemetry events using message routing, or reach to non-telemetry events using Azure Event Grid. To learn more about IoT Hub message routing, see [IoT Hub message routing](iot-hub-devguide-messages-d2c.md) and [React to IoT Hub events by using Event Grid](./iot-hub-event-grid.md).
1717

@@ -34,7 +34,7 @@ Non-telemetry events share several common properties.
3434

3535
### System properties
3636

37-
The following system properties are set by IoT Hub on each event.
37+
IoT Hub sets the following system properties on each event.
3838

3939
| Property | Type |Description | Keyword for routing query |
4040
| -------- | ---- | ---------- | ------------------------- |
@@ -49,7 +49,7 @@ The following system properties are set by IoT Hub on each event.
4949

5050
### Application properties
5151

52-
The following application properties are set by IoT Hub on each event.
52+
IoT Hub sets the following application properties on each event.
5353

5454
| Property | Type |Description |
5555
| -------- | ---- | ---------- |
@@ -79,7 +79,7 @@ Connection state events are emitted whenever a device or module connects or disc
7979
| ---- | ----------- |
8080
| iothub-message-source | deviceConnectionStateEvents |
8181

82-
**Body**: The body contains a sequence number. The sequence number is a string representation of a hexadecimal number. You can use string compare to identify the larger number. If you're converting the string to hex, then the number will be a 256-bit number. The sequence number is strictly increasing, and the latest event will have a higher number than other events. This is useful if you have frequent device connects and disconnects, and want to ensure only the latest event is used to trigger a downstream action.
82+
**Body**: The body contains a sequence number. The sequence number is a string representation of a hexadecimal number. You can use string compare to identify the larger number. If you're converting the string to hex, then the number will be a 256-bit number. The sequence number is strictly increasing, so the latest event has a higher number than older events. This is useful if you have frequent device connects and disconnects, and want to ensure that only the latest event is used to trigger a downstream action.
8383

8484
### Example
8585

@@ -139,7 +139,7 @@ Device lifecycle events are emitted whenever a device or module is created or de
139139
| ---- | ----------- |
140140
| iothub-message-source | deviceLifecycleEvents |
141141

142-
**Body**: The body contains a representation of the device twin or module twin. It includes the device ID and module ID, the twin etag, the version property, and the tags, properties and associated metadata of the twin.
142+
**Body**: The body contains a representation of the device twin or module twin. It includes the device ID and module ID, the twin etag, the version property, and the tags, properties, and associated metadata of the twin.
143143

144144
### Example
145145

@@ -218,7 +218,7 @@ Device twin change events are emitted whenever a device twin or a module twin is
218218
| ---- | ----------- |
219219
| iothub-message-source | twinChangeEvents |
220220

221-
**Body**: On an update, the body contains the version property of the twin and the updated tags and properties and their associated metadata. On a replace, the body contains the device ID and module ID, the twin etag, the version property, and all the tags, properties and associated metadata of the device or module twin.
221+
**Body**: On an update, the body contains the version property of the twin and the updated tags and properties and their associated metadata. On a replace, the body contains the device ID and module ID, the twin etag, the version property, and all the tags, properties, and associated metadata of the device or module twin.
222222

223223
### Example
224224

0 commit comments

Comments
 (0)