Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QueueClient

Package version

A QueueClient represents a URL to an Azure Storage Queue's messages allowing you to manipulate its messages.

export

Hierarchy

Index

Constructors

constructor

Properties

accountName

accountName: string

Protected storageClientContext

storageClientContext: StorageClientContext

StorageClientContext is a reference to protocol layer operations entry, which is generated by AutoRest generator.

memberof

StorageClient

url

url: string

URL string value.

memberof

StorageClient

Accessors

name

  • get name(): string

Methods

clearMessages

create

createIfNotExists

delete

deleteIfExists

deleteMessage

exists

  • Returns true if the specified queue exists; false otherwise.

    NOTE: use this function with care since an existing queue might be deleted by other clients or applications. Vice versa new queues might be added by other clients or applications after this function completes.

    memberof

    QueueClient

    Parameters

    Returns Promise<boolean>

generateSasUrl

getAccessPolicy

getProperties

peekMessages

receiveMessages

  • receiveMessages retrieves one or more messages from the front of the queue.

    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/get-messages

    memberof

    QueueClient

    Example usage:

    const response = await queueClient.receiveMessages();
    if (response.receivedMessageItems.length == 1) {
      const receivedMessageItem = response.receivedMessageItems[0];
      console.log("Processing & deleting message with content:", receivedMessageItem.messageText);
      const deleteMessageResponse = await queueClient.deleteMessage(
        receivedMessageItem.messageId,
        receivedMessageItem.popReceipt
      );
      console.log(
        "Delete message successfully, service assigned request Id:",
        deleteMessageResponse.requestId
      );
    }

    Parameters

    Returns Promise<QueueReceiveMessageResponse>

    Response data for the receive messages operation.

sendMessage

  • sendMessage adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content is up to 64KB in size, and must be in a format that can be included in an XML request with UTF-8 encoding. To include markup in the message, the contents of the message must either be XML-escaped or Base64-encode.

    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/put-message

    memberof

    QueueClient

    Example usage:

    const sendMessageResponse = await queueClient.sendMessage("Hello World!");
    console.log(
      "Sent message successfully, service assigned message Id:", sendMessageResponse.messageId,
      "service assigned request Id:", sendMessageResponse.requestId
    );

    Parameters

    Returns Promise<QueueSendMessageResponse>

    Response data for the send messages operation.

setAccessPolicy

setMetadata

updateMessage

  • Update changes a message's visibility timeout and contents. The message content is up to 64KB in size, and must be in a format that can be included in an XML request with UTF-8 encoding. To include markup in the message, the contents of the message must either be XML-escaped or Base64-encode.

    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/update-message

    memberof

    QueueClient

    Parameters

    • messageId: string

      Id of the message

    • popReceipt: string

      A valid pop receipt value returned from an earlier call to the receive messages or update message operation.

    • Optional message: undefined | string

      Message to update. If this parameter is undefined, then the content of the message won't be updated.

    • Optional visibilityTimeout: undefined | number

      Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.

    • Default value options: QueueUpdateMessageOptions = {}

    Returns Promise<QueueUpdateMessageResponse>

    Response data for the update message operation.

Generated using TypeDoc