You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-amqp-support.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: kgremban
5
5
ms.service: iot-hub
6
6
services: iot-hub
7
7
ms.topic: conceptual
8
-
ms.date: 04/30/2019
8
+
ms.date: 04/21/2022
9
9
ms.author: kgremban
10
10
ms.custom: [amqp, mqtt]
11
11
---
@@ -316,6 +316,8 @@ while True:
316
316
317
317
You can also send telemetry messages from a device by using AMQP. The device can optionally provide a dictionary of application properties, or various message properties, such as message ID.
318
318
319
+
To route messages based on message body, you must set the `content_type` property to be `application/json;charset=utf-8`. To learn more about routing messages either based on message properties or message body, please see the [IoT Hub message routing query syntax documentation](iot-hub-devguide-routing-query-syntax.md).
320
+
319
321
The following code snippet uses the [uAMQP library in Python](https://github.com/Azure/azure-uamqp-python) to send device-to-cloud messages from a device.
To support seamless interoperability across protocols, IoT Hub defines a common message format for all device-facing protocols. This message format is used for both [device-to-cloud routing](iot-hub-devguide-messages-d2c.md) and [cloud-to-device](iot-hub-devguide-messages-c2d.md) messages.
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).
* 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.
26
26
27
-
* An opaque binary body.
27
+
* A message body, which can be any type of data.
28
+
29
+
Each device protocol implements setting properties in different ways. Please see the related [MQTT](./iot-hub-mqtt-support.md) and [AMQP](./iot-hub-amqp-support.md) developer guides for details.
28
30
29
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.
30
32
@@ -42,6 +44,22 @@ Device-to-cloud messaging with IoT Hub has the following characteristics:
42
44
43
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
46
47
+
> [!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
+
>
50
+
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`.
52
+
53
+
A valid, routable message body may look like the following:
54
+
55
+
```json
56
+
{
57
+
"timestamp": "2022-02-08T20:10:46Z",
58
+
"tag_name": "spindle_speed",
59
+
"tag_value": 100
60
+
}
61
+
```
62
+
45
63
## System Properties of **D2C** IoT Hub messages
46
64
47
65
| Property | Description |User Settable?|Keyword for </br>routing query|
0 commit comments