Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing system properties #38

Closed
AntoineGagne opened this issue Mar 7, 2019 · 5 comments
Closed

Accessing system properties #38

AntoineGagne opened this issue Mar 7, 2019 · 5 comments
Assignees

Comments

@AntoineGagne
Copy link

AntoineGagne commented Mar 7, 2019

Hi everyone,

Is there any way to access the system properties (i.e. accessing a property such as iothub-connection-device-id). In the other SDKs, I have seen some methods to be able to access them, but I have not seen a way to do the same with this SDK.

Thank you!

@dcristoloveanu dcristoloveanu self-assigned this Mar 11, 2019
@dcristoloveanu
Copy link
Member

When receiving the receiver gets the application properties from the AMQP message, so it should be possible to get all the IoTHub properties that are stuck in the application properties from the event data by using EventData_Properties.

IIRC correctly the IoT Hub properties are packaged in the application properties of the AMQP message.

I did not get to try the specific property on the latest master. Once I do I’ll reply here.

@Benjamin118
Copy link

Benjamin118 commented Sep 11, 2019

Hi everyone,

I agree with @AntoineGagne : Iothub client knows the notion of system properties (as MessageId or MessageCorrelationId), not to be confused with user (or custom) properties associated to the message.

With using EventData_Properties, we only have access on user properties, and eventDataHandle doesn't contain system properties (see attached log)

We need these system properties to check full integrity of received message on eventHub.

EventHub_Issue_38_system_properties_missing.log

@alexmrtn
Copy link

Hi,

I did some additional instigation and there is indeed a missing piece here. The properties on a received event does not contains the message ID.

I checked in the azure-iot-c-sdk repo, the AMQP transport protocol uses properties_set_message_id function to set on the AMQP message the user-defined message ID of the IOTHUB_MESSAGE_HANDLE. However in this repo the corresponding properties_get_message_id is never used when the AMQP message is transformed to a EVENTDATA_HANDLE.

How can we solve this without having to use a custom property for the message ID ?

Thanks!

@anthonyvercolano
Copy link

anthonyvercolano commented Nov 18, 2020

@AntoineGagne
This is from Node, but this is the actual location of the device id.
if (eventData.annotations['iothub-connection-device-id'] === provisionedDevice.deviceId)
@dcristoloveanu & @Benjamin118

@anthonyvercolano
Copy link

Really using the C SDK to get this isn't the best path. Use something like the azure node event hub sdk which can provide what you need. Probably the C# one does also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants