We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @azure/amqp-common.Constants.maxDurationValue function in @azure/amqp-common

To help you get started, we’ve selected a few @azure/amqp-common 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-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
}
    if (msg.message_annotations[Constants.sequenceNumber] != null) {
      if (Buffer.isBuffer(msg.message_annotations[Constants.sequenceNumber])) {
        props.sequenceNumber = Long.fromBytesBE(msg.message_annotations[Constants.sequenceNumber]);
      } else {
        props.sequenceNumber = Long.fromNumber(msg.message_annotations[Constants.sequenceNumber]);
      }
    }
    if (msg.message_annotations[Constants.enqueuedTime] != null) {
      props.enqueuedTimeUtc = new Date(msg.message_annotations[Constants.enqueuedTime] as number);
    }
    if (msg.message_annotations[Constants.lockedUntil] != null) {
      props.lockedUntilUtc = new Date(msg.message_annotations[Constants.lockedUntil] as number);
    }
  }
  if (msg.ttl != null && msg.ttl >= Constants.maxDurationValue - props.enqueuedTimeUtc.getTime()) {
    props.expiresAtUtc = new Date(Constants.maxDurationValue);
  } else {
    props.expiresAtUtc = new Date(props.enqueuedTimeUtc.getTime() + msg.ttl!);
  }

  const rcvdsbmsg: ReceivedMessageInfo = {
    _amqpMessage: msg,
    _delivery: delivery,
    deliveryCount: msg.delivery_count,
    lockToken:
      delivery && delivery.tag && delivery.tag.length !== 0
        ? uuid_to_string(
            shouldReorderLockToken === true
              ? reorderLockToken(
                  typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag
                )
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
if (msg.message_annotations[Constants.sequenceNumber] != null) {
      if (Buffer.isBuffer(msg.message_annotations[Constants.sequenceNumber])) {
        props.sequenceNumber = Long.fromBytesBE(msg.message_annotations[Constants.sequenceNumber]);
      } else {
        props.sequenceNumber = Long.fromNumber(msg.message_annotations[Constants.sequenceNumber]);
      }
    }
    if (msg.message_annotations[Constants.enqueuedTime] != null) {
      props.enqueuedTimeUtc = new Date(msg.message_annotations[Constants.enqueuedTime] as number);
    }
    if (msg.message_annotations[Constants.lockedUntil] != null) {
      props.lockedUntilUtc = new Date(msg.message_annotations[Constants.lockedUntil] as number);
    }
  }
  if (msg.ttl != null && msg.ttl >= Constants.maxDurationValue - props.enqueuedTimeUtc.getTime()) {
    props.expiresAtUtc = new Date(Constants.maxDurationValue);
  } else {
    props.expiresAtUtc = new Date(props.enqueuedTimeUtc.getTime() + msg.ttl!);
  }

  const rcvdsbmsg: ReceivedMessageInfo = {
    _amqpMessage: msg,
    _delivery: delivery,
    deliveryCount: msg.delivery_count,
    lockToken:
      delivery && delivery.tag && delivery.tag.length !== 0
        ? uuid_to_string(
            shouldReorderLockToken === true
              ? reorderLockToken(
                  typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag
                )
              : typeof delivery.tag === "string"
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
}
  if (msg.messageId != null) {
    if (typeof msg.messageId === "string" && msg.messageId.length > Constants.maxMessageIdLength) {
      throw new Error(
        "Length of 'messageId' property on the message cannot be greater than 128 characters."
      );
    }
    amqpMsg.message_id = msg.messageId;
  }
  if (msg.correlationId != null) {
    amqpMsg.correlation_id = msg.correlationId;
  }
  if (msg.replyToSessionId != null) {
    amqpMsg.reply_to_group_id = msg.replyToSessionId;
  }
  if (msg.timeToLive != null && msg.timeToLive !== Constants.maxDurationValue) {
    amqpMsg.ttl = msg.timeToLive;
    amqpMsg.creation_time = Date.now();
    if (Constants.maxAbsoluteExpiryTime - amqpMsg.creation_time > amqpMsg.ttl) {
      amqpMsg.absolute_expiry_time = amqpMsg.creation_time + amqpMsg.ttl;
    } else {
      amqpMsg.absolute_expiry_time = Constants.maxAbsoluteExpiryTime;
    }
  }
  if (msg.partitionKey != null) {
    if (msg.partitionKey.length > Constants.maxPartitionKeyLength) {
      throw new Error(
        "Length of 'partitionKey' property on the message cannot be greater than 128 characters."
      );
    }
    amqpMsg.message_annotations![Constants.partitionKey] = msg.partitionKey;
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
if (msg.message_annotations[Constants.sequenceNumber] != null) {
      if (Buffer.isBuffer(msg.message_annotations[Constants.sequenceNumber])) {
        props.sequenceNumber = Long.fromBytesBE(msg.message_annotations[Constants.sequenceNumber]);
      } else {
        props.sequenceNumber = Long.fromNumber(msg.message_annotations[Constants.sequenceNumber]);
      }
    }
    if (msg.message_annotations[Constants.enqueuedTime] != null) {
      props.enqueuedTimeUtc = new Date(msg.message_annotations[Constants.enqueuedTime] as number);
    }
    if (msg.message_annotations[Constants.lockedUntil] != null) {
      props.lockedUntilUtc = new Date(msg.message_annotations[Constants.lockedUntil] as number);
    }
  }
  if (msg.ttl != null && msg.ttl >= Constants.maxDurationValue - props.enqueuedTimeUtc.getTime()) {
    props.expiresAtUtc = new Date(Constants.maxDurationValue);
  } else {
    props.expiresAtUtc = new Date(props.enqueuedTimeUtc.getTime() + msg.ttl!);
  }

  const rcvdsbmsg: ReceivedMessageInfo = {
    _amqpMessage: msg,
    _delivery: delivery,
    deliveryCount: msg.delivery_count,
    lockToken:
      delivery && delivery.tag && delivery.tag.length !== 0
        ? uuid_to_string(
            shouldReorderLockToken === true
              ? reorderLockToken(
                  typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag
                )
              : typeof delivery.tag === "string"