private _extractPropertiesFromTopicPart()

in device/transport/mqtt/src/mqtt.ts [882:925]


  private _extractPropertiesFromTopicPart(properties: string, msg: Message): void {
    const keyValuePairs = properties.split('&');

    for (let i = 0; i < keyValuePairs.length; i++) {
      const keyValuePair = keyValuePairs[i].split('=');
      const k = decodeURIComponent(keyValuePair[0]);
      const v = decodeURIComponent(keyValuePair[1]);

      switch (k) {
        case '$.mid':
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_008: [When a message is received, the receiver shall populate the generated `Message` object `messageId` with the value of the property `$.mid` serialized in the topic, if present.]*/
          msg.messageId = v;
          break;
        case '$.to':
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_009: [When a message is received, the receiver shall populate the generated `Message` object `to` with the value of the property `$.to` serialized in the topic, if present.]*/
          msg.to = v;
          break;
        case '$.exp':
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_010: [When a message is received, the receiver shall populate the generated `Message` object `expiryTimeUtc` with the value of the property `$.exp` serialized in the topic, if present.]*/
          msg.expiryTimeUtc = v;
          break;
        case '$.cid':
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_011: [When a message is received, the receiver shall populate the generated `Message` object `correlationId` with the value of the property `$.cid` serialized in the topic, if present.]*/
          msg.correlationId = v;
          break;
        case '$.uid':
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_012: [When a message is received, the receiver shall populate the generated `Message` object `userId` with the value of the property `$.uid` serialized in the topic, if present.]*/
          msg.userId = v;
          break;
          case '$.ct':
            /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_013: [When a message is received, the receiver shall populate the generated `Message` object `contentType` with the value of the property `$.ct` serialized in the topic, if present.]*/
            msg.contentType = <any>v;
            break;
          case '$.ce':
            /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_014: [When a message is received, the receiver shall populate the generated `Message` object `contentEncoding` with the value of the property `$.ce` serialized in the topic, if present.]*/
            msg.contentEncoding = <any>v;
            break;
        default:
          /*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_007: [When a message is received, the receiver shall populate the generated `Message` object `properties` property with the user properties serialized in the topic.]*/
          msg.properties.add(k, v);
          break;
      }
    }
  }