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
class

QueueClient

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.

type

{StorageClientContext}

memberof

StorageClient

url

url: string

URL string value.

type

{string}

memberof

StorageClient

Accessors

name

  • get name(): string

Methods

clearMessages

create

delete

deleteMessage

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
    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 succesfully, 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
    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.

    • message: string

      Message to update.

    • 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