Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Microsoft.Azure.IoT.Gateway/ message content type #505

Open
damonbarry opened this issue Feb 2, 2018 · 5 comments
Open

Microsoft.Azure.IoT.Gateway/ message content type #505

damonbarry opened this issue Feb 2, 2018 · 5 comments

Comments

@damonbarry
Copy link
Member

damonbarry commented Feb 2, 2018

Copied from Azure/azure-iot-protocol-gateway#114 (@almusawi):

Hi,

I am using Iot hub edge (V1) and it works fine in sending the data. but by using Microsoft.Azure.IoT.Gateway ,the message class, I can not set the content type for the message before sending it to the Iothub. and I can not use the Microsoft.Azure.Devices.Client in the Iot edge model which has in the message class the message.ContentEncoding = "utf-32" and message.ContentType = "application/json";.

Could you please help in that? How to add the content type to a message send by IoT edge model to Iot hub?

Thanks

@almusawi
Copy link

almusawi commented Feb 8, 2018

Hi, any ideas on this question?

@Zuendelmeister
Copy link

Why can't you use the Microsoft.Azure.Devices.Client?

@almusawi
Copy link

almusawi commented Feb 9, 2018

@Zuendelmeister it does not accepted when you try to publish the message to the broker

@Zuendelmeister
Copy link

Well in my knowledge its is like the following:
broker message: Microsoft.Azure.IoT.Gateway
message to iot hub: Microsoft.Azure.Devices.Client

Hence you have to use both. The ContentType and Encoding on the broker should not be important. And to send it to your IoTHub you can set it in the Microsoft.Azure.Devices.Client.Message.

@damonbarry
Copy link
Member Author

We automatically copy the broker message's properties over to the IoT Hub message. However, we don't map anything into the IoT Hub message's system properties, and I think the content encoding and type are both system properties.

I believe we'd have to make changes to the iothub module, to the function IoTHubMessage_CreateFromGWMessage here: https://github.com/Azure/iot-edge/blob/2018-01-31/v1/modules/iothub/src/iothub.c#L642. When it maps properties between messages, it should look for the content encoding & type properties specifically and map them to system properties.

It sounds like a fairly easy fix, but I don't think the core team will be able to do this work anytime soon. If you'd like to do the work and make a pull request, we'd love to get it integrated into the repo.

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

No branches or pull requests

3 participants