in dotnet/src/Azure.Iot.Operations.Protocol/RPC/CommandRequestMetadata.cs [87:124]
internal CommandRequestMetadata(MqttApplicationMessage message, string topicPattern)
{
CorrelationId = message.CorrelationData != null && GuidExtensions.TryParseBytes(message.CorrelationData, out Guid? correlationId)
? correlationId!.Value
: throw new ArgumentException($"Invalid property -- CorrelationData in request message is null or not parseable as a GUID", nameof(message));
InvokerClientId = null;
Timestamp = null;
UserData = [];
if (message.UserProperties != null)
{
foreach (MqttUserProperty property in message.UserProperties)
{
switch (property.Name)
{
case AkriSystemProperties.Timestamp:
Timestamp = HybridLogicalClock.DecodeFromString(AkriSystemProperties.Timestamp, property.Value);
break;
case AkriSystemProperties.SourceId:
InvokerClientId = property.Value;
break;
case "$partition":
Partition = property.Value;
break;
default:
if (!AkriSystemProperties.IsReservedUserProperty(property.Name))
{
UserData[property.Name] = property.Value;
}
break;
}
}
}
TopicTokens = topicPattern != null ? MqttTopicProcessor.GetReplacementMap(topicPattern, message.Topic) : new Dictionary<string, string>();
}