Search code examples
c#azureazure-iot-hubbrokeredmessage

IotHub message routed to Service Bus losing ContentType property?


I'm trying to route device messages coming to IotHub using message routing based on message properties. I'm routing them to a service bus topic. However, I'm seeing that despite setting the ContentType property of the

Microsoft.Azure.Devices.Client.Message

class before sending to IoTHub, the same property is not seen populated for the Brokered message that comes after message routing succeeds.

Is there something I'm missing here?

Code at device side:

Message message = new Message(payload);
message.ContentType = "application/jsonstream";
await this.deviceClient.SendEventAsync(message);

Code at receiver side:

BrokeredMessage msgFromDevice = MessageReceiver.ReceiveAsync();

Now the problem is

msgFromDevice.ContentType

is null.

Any ideas or guidance in this?

Thanks!


Solution

  • this is a bug and it has been already reported - see more details here.