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

CreationTimeUtc for D2C message #1568

Closed
sanjeev-magoo opened this issue Jun 22, 2020 · 6 comments
Closed

CreationTimeUtc for D2C message #1568

sanjeev-magoo opened this issue Jun 22, 2020 · 6 comments

Comments

@sanjeev-magoo
Copy link

sanjeev-magoo commented Jun 22, 2020

This is regarding setting of system property(CreationTimeUtc) to D2C message. Basically, we wanted to set CreationTimeUtc timestamp in every telemetry message originated from device. It is possible that device is generating D2C messages when working in offline mode, when these messages reached to cloud, we want to know the actual creation time of these messages.
Our findings-

  1. We checked and found that “CreationTimeUtc” property on Message is only supported by C# and Java SDK. We are not able to find support in C SDK. Refer reference Connection intermittant #1.
  2. Looks like CreationTimeUtc property on Message in the C# SDK results in SystemProperty “iothub-creation-time-utc” to be added on the message that is sent to IoT Hub, refer reference Updated Reame files accross the repository #2.
  3. Refer readme.md file mentioned in reference Updated C samples to use MQTT by default #3, Refer the following section-
Send device-to-cloud message ✔️* ✔️* ✔️* ✔️* ✔️* Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add custom properties. IoT Hub only supports batch send over AMQP and HTTPS only at the moment. This SDK supports batch send over HTTP. * Batch send over AMQP and AMQP-WS, and add system properties on D2C messages are in progress.
  1. Refer another reference Compilation issue while compiling using cross compiler for arm platform - Look like linking issue #4 for same property.

Questions-

  1. Could you please let us when this feature will be available with C SDK?
  2. Let us know, If there is way to set “iothub-creation-time-utc“ property programmatically in system properties of D2C message?

Note- We can temporarily set this property in application properties, but we are looking for solution using system properties as recommended by MS and to minimize the changes later.

References-

  1. Creation Time UTC not exposed in device client SDK Message class azure-iot-sdk-java#397
  2. https://github.com/Azure/azure-iot-sdk-csharp/blob/cd93e75fd8914b6247f23eb6a5cfd7aea459676f/iothub/device/src/MessageSystemPropertyNames.cs.
  3. https://github.com/Azure/azure-iot-sdk-c/blob/master/readme.md
  4. Creation Time Utc azure-iot-sdk-csharp#376
@ericwolz
Copy link
Contributor

I can add this work to the backlog. Does this actually work for you?? When I do it, the creation time is not on the system properties, but on the message properties. Routing to blob storage does not respect the creation time. How are you using this??

{
"body": {
"foo": "bar"
},
"enqueuedTime": "2020-06-24T23:19:20.263Z",
"properties": {
"iothub-creation-time-utc": "2020-05-01T21:21:02.264Z"
},
"systemProperties": {
"iothub-connection-device-id": "01233EAD58E86797FE",
"iothub-connection-auth-method": "{"scope":"device","type":"sas","issuer":"iothub","acceptingIpFilterRule":null}",
"iothub-connection-auth-generation-id": "637279390182254368",
"iothub-enqueuedtime": 1593040760216,
"iothub-message-source": "Telemetry",
"x-opt-sequence-number": 17839,
"x-opt-offset": "34359746048",
"x-opt-enqueued-time": 1593040760263
}
}

@rajaggrawal
Copy link
Contributor

rajaggrawal commented Jul 20, 2020

we can route D2C messages to kusto/blob storage and purpose is to store message creation time for each messages.
could you please let us know the correct way to send creation time along with D2C message and same can be redirect to kusto/blob?

@sanjeev-magoo
Copy link
Author

sanjeev-magoo commented Jul 21, 2020

@ericwol-msft - If application properties are not available to destination resources, this will not solve our use case. We wanted to route data to following resources-

  1. Blob storage
  2. Event Hub
  3. Kusto DB

We are providing interface to work with Azure IoT. Multiple teams will consuming this interface. One option(#1) is, each message body shall contain the creation-timestamp, in this case, each team consuming our interface will need to add this in their message body, other option (#2) is, we add creation-timestamp in system properties at common place.

Consuming applications consuming messages from blob storage, event hub and Kusto DB needs this information for their business logic.
we wanted to go with #2 option. how do we support this? suggestions are highly appreciated. Any plan to support this property in system properties via C SDK?

@sanjeev-magoo
Copy link
Author

@ericwol-msft - Thanks for the PR. Hoping this feature is supported for MQTT over websocket protocol from device to IoTHub.

ericwolz added a commit that referenced this issue Aug 6, 2020
* CreationTimeUtc for D2C message #1568

* pr feedback

* added user id system property

* Fixed user id unit test

* update .def file

* added properties to AMQP

* amqp ut update
@ericwolz
Copy link
Contributor

ericwolz commented Aug 6, 2020

This is now in master branch. Please use IoTHubMessage_SetMessageCreationTimeUtcSystemProperty to set the creation time on the message

@ericwolz ericwolz closed this as completed Aug 6, 2020
@az-iot-builder-01
Copy link
Collaborator

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

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

No branches or pull requests

4 participants