amenzhinsky / iothub

Azure IoT Hub SDK for Golang
MIT License
53 stars 58 forks source link

CreationTimeUtc is not handled in message #44

Open reddyduggempudi opened 3 years ago

reddyduggempudi commented 3 years ago

Device can buffer up messages and send them all at some frequency. To accomplish, you can set CreationTimeUtc (payload creation time) in the event message. common.Message has this field, but looks like it is not set in the transport.send() https://github.com/amenzhinsky/iothub/blob/master/iotdevice/transport/mqtt/mqtt.go#L480 You need to set "$.ctime". Similarly other properties need to be honored like https://github.com/Azure/azure-iot-sdk-csharp/blob/master/iothub/device/src/Transport/Mqtt/MqttIotHubAdapter.cs#L1197

amenzhinsky commented 3 years ago

https://github.com/amenzhinsky/iothub/commit/377c09107e8bb2da887d4c52eca5be6819e285c0

But I'm not sure about time format though, Azure uses different time formats across API, for now it simply pushes ctime to amqp.ApplicationProperties that goes to msg.Properties["iothub-creation-time-utc"] as a raw string with no time parsing.

reddyduggempudi commented 3 years ago

I followed up internally with the team. The format for this time should beFormat("2006-01-02T15:04:05") E.g.: 2021-23-03T17:38:59

So, please change it to above format.