How to use the rhea.uuid_to_string function in rhea

To help you get started, we’ve selected a few rhea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / common / transport / amqp / src / amqp_message.ts View on Github external
}

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_006: [The `toMessage` method shall set the `Message.expiryTimeUtc` property to the `AmqpMessage.absolute_expiry_time` value if it is present.]*/
    if (amqpMessage.absolute_expiry_time) {
      msg.expiryTimeUtc = amqpMessage.absolute_expiry_time;
    }

    //
    // The rhea library will de-serialize an encoded uuid (0x98) as a 16 byte buffer.
    // Since common messages should only have type string it is safe to decode
    // these as strings.
    //
    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_004: [The `toMessage` method shall set the `Message.messageId` property to the `AmqpMessage.message_id` value if it is present.]*/
    if (amqpMessage.message_id) {
      if (((amqpMessage.message_id as any) instanceof Buffer) && (amqpMessage.message_id.length === 16)) {
        msg.messageId = rheaUuidToString(amqpMessage.message_id as any);
      } else {
        msg.messageId = amqpMessage.message_id;
      }
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_003: [The `toMessage` method shall set the `Message.correlationId` property to the `AmqpMessage.correlation_id` value if it is present.]*/
    if (amqpMessage.correlation_id) {
      if (((amqpMessage.correlation_id as any) instanceof Buffer) && (amqpMessage.correlation_id.length === 16)) {
        msg.correlationId = rheaUuidToString(amqpMessage.correlation_id as any);
      } else {
        msg.correlationId = amqpMessage.correlation_id;
      }
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_016: [The `toMessage` method shall set the `Message.contentType` property to the `AmqpMessage.content_type` value if it is present. ]*/
    if (amqpMessage.content_type) {
github Azure / azure-iot-sdk-node / common / transport / amqp / src / amqp_message.ts View on Github external
// Since common messages should only have type string it is safe to decode
    // these as strings.
    //
    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_004: [The `toMessage` method shall set the `Message.messageId` property to the `AmqpMessage.message_id` value if it is present.]*/
    if (amqpMessage.message_id) {
      if (((amqpMessage.message_id as any) instanceof Buffer) && (amqpMessage.message_id.length === 16)) {
        msg.messageId = rheaUuidToString(amqpMessage.message_id as any);
      } else {
        msg.messageId = amqpMessage.message_id;
      }
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_003: [The `toMessage` method shall set the `Message.correlationId` property to the `AmqpMessage.correlation_id` value if it is present.]*/
    if (amqpMessage.correlation_id) {
      if (((amqpMessage.correlation_id as any) instanceof Buffer) && (amqpMessage.correlation_id.length === 16)) {
        msg.correlationId = rheaUuidToString(amqpMessage.correlation_id as any);
      } else {
        msg.correlationId = amqpMessage.correlation_id;
      }
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_016: [The `toMessage` method shall set the `Message.contentType` property to the `AmqpMessage.content_type` value if it is present. ]*/
    if (amqpMessage.content_type) {
      msg.contentType = amqpMessage.content_type;
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_017: [The `toMessage` method shall set the `Message.contentEncoding` property to the `AmqpMessage.content_encoding` value if it is present. ]*/
    if (amqpMessage.content_encoding) {
      msg.contentEncoding = amqpMessage.content_encoding;
    }

    /*Codes_SRS_NODE_IOTHUB_AMQPMSG_16_007: [The `toMessage` method shall convert the user-defined `AmqpMessage.applicationProperties` to a `Properties` collection stored in `Message.properties`.]*/