0
votes

I'm using Azure IoT Edge in transparent gateway mode. Now I would like to add a property to any message from leaf devices that gets passed through the Edge gateway, that basically contains the Edge device id (or its hostname etc). Thus allowing to trace the message flow.

Is this somehow possible? I already tried to put a custom module in between which I would just route all messages through:

"fromRaw": "FROM /messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO BrokeredEndpoint(\"/modules/taggingmodule/inputs/input1\")",
"intoUpstream": "FROM /messages/modules/taggingmodule/* INTO $upstream"

But doing this I lose the "transparent" message-passing. Any messages that are then received in the cloud IoT Hub appear to come from the Edge device instead of the leaf device.

1

1 Answers

1
votes

In this way, it is not what the transparent gateway was designed.(Ref: here.)

The gateway simply passes communications between the devices and IoT Hub. The devices are unaware that they are communicating with the cloud via a gateway and a user interacting with the devices in IoT Hub is unaware of the intermediate gateway device.

To workaround this issue, there are two options:

  1. Based on what you did for now, embed additional information in messages that generated on the leaf device to identify where the message comes from.
  2. Remove custom module in the transparent gateway. Add Edge device id (or its hostname etc) in leaf device message.