Skip to content

Commit

Permalink
fix(iothub-client): Fix device messages with DTDL component name fail…
Browse files Browse the repository at this point in the history
… over HTTP

Fix HttpTransportHandler fails to translate message.SystemProperties["dt-subject"] because of missing mapping in CustomHeaderConstants, so telemetry messages from devices following IoT Plug and Play conventions fail to be sent over HTTP.
  • Loading branch information
Björn Jarisch authored and David R. Williamson committed May 5, 2021
1 parent c1797a0 commit 071ac3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions iothub/device/src/Common/WebApi/CustomHeaderConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,10 @@ internal static class CustomHeaderConstants
/// Used to indicate that the message is a security message
/// </summary>
public const string InterfaceId = "iothub-interface-id";

/// <summary>
/// Used to specify the DTDL component name
/// </summary>
public const string ComponentName = "dt-subject";
}
}
3 changes: 2 additions & 1 deletion iothub/device/src/Transport/HttpTransportHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ internal sealed class HttpTransportHandler : TransportHandler
{ MessageSystemPropertyNames.CreationTimeUtc, CustomHeaderConstants.CreationTimeUtc },
{ MessageSystemPropertyNames.ContentType, CustomHeaderConstants.ContentType },
{ MessageSystemPropertyNames.ContentEncoding, CustomHeaderConstants.ContentEncoding },
{ MessageSystemPropertyNames.InterfaceId, CustomHeaderConstants.InterfaceId }
{ MessageSystemPropertyNames.InterfaceId, CustomHeaderConstants.InterfaceId },
{ MessageSystemPropertyNames.ComponentName, CustomHeaderConstants.ComponentName }
};

private static readonly IDictionary<string, string> s_mapHttpHeadersToMessageProperties = new Dictionary<string, string>
Expand Down

0 comments on commit 071ac3c

Please sign in to comment.