question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message properties seem to get lost after routing through edgeHub

See original GitHub issue
  • OS and version used: Debian Stretch on leaf device, Raspbian stretch on edge gateway

  • Python runtime used: 3.5.3

  • SDK version used: 1.4.3

  • IoT Edge version used: 1.0.4

Description of the issue:

I’m running a Raspberry Pi as a transparent IoT Edge Gateway with two custom modules in addition to the edgeAgent and edgeHub. The edgeHub is configured to route the messages coming from leaf device to one of the custom module with the route below.

"FROM /messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO BrokeredEndpoint(\"/modules/camera-capture/inputs/input1\")"

In the module I added a function which listens for incoming messages on input1 and I can see the messages and print the message body. In the leaf device application I’m sending messages via MQTT with application properties (see code snippet 1). When I change the route to…

"FROM /messages/* WHERE (CameraState = 'true') INTO BrokeredEndpoint(\"/modules/camera-capture/inputs/input1\")"

…only half of the messages are routed to the module which indicates that the property is found by the edgeHub and interpreted correctly. However, when I try to extract the properties of the message in the CameraCapture module (see code snippet 2) they seem to be empty (see console output).

So it seems like the message properties are getting lost after routing through the edge hub. Also same result using AMQP.

Code sample exhibiting the issue:

Code snippet 1 (sending message):

client = IoTHubClient(CONNECTION_STRING, PROTOCOL)
set_certificates(client)
message = IoTHubMessage("test message")
    
# send a message every two seconds
while True:
     # add custom application properties
     prop_map = message.properties()
     if run_camera:
         prop_map.add_or_update("CameraState", "true")
     else:
         prop_map.add_or_update("CameraState", "false")

     client.send_event_async(message, send_confirmation_callback, None)
     print("Message transmitted to IoT Edge")
     time.sleep(2)

Code snippet 2 (receiving message):

def receive_message_callback(message, hubManager):
    global RECEIVE_CALLBACKS
    message_buffer = message.get_bytearray()
    size = len(message_buffer)
    print ( "Message received: %s" % message_buffer[:size].decode('utf-8'))
    map_properties = message.properties()
    key_value_pair = map_properties.get_internals()
    print ("Key value pair: %s" % key_value_pair)
    return IoTHubMessageDispositionResult.ACCEPTED

Console log of the issue:

Message received: test message
Key value pair: {}
Waiting...
Waiting...
Message received: test message
Key value pair: {}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
pierrecacommented, Jan 18, 2019

@MaWa19 thanks for filing this issue and sorry for the delay in triaging it. I’ll look into it ASAP.

0reactions
az-iot-builder-01commented, Jan 2, 2020

@MaWa19, @sense2k8, @darthkurak, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

Read more comments on GitHub >

github_iconTop Results From Across the Web

Message properties seem to get lost after routing through ...
So it seems like the message properties are getting lost after routing through the edge hub. Also same result using AMQP.
Read more >
When EdgeHub disconnects from IoT Hub, Desired Properties ...
Our module reads configuration from desired properties. Expected behavior is that when EdgeHub losses cloud connectivity for whatever reason.
Read more >
Troubleshoot Azure IoT message routing - Microsoft Learn
In this article. Monitoring message routing; Top issues; Last known errors for IoT Hub routing endpoints; Routes resource logs; Next steps.
Read more >
Flexible message routing in Azure IoT Hub using C# – Sander ...
Should we pollute the message with this 'routing' information? ... First, the message properties are extra annotations (defined by the IoT ...
Read more >
VeloCloud Administration Guide | VMware SD-WAN 3.3
The components are described in more detail in the following sections. ... connections to a VeloCloud Site such as an Edge Hub or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found