QueueServiceClient class
QueueServiceClient는 큐를 조작할 수 있는 Azure Storage 큐 서비스에 대한 URL을 나타냅니다.
- Extends
-
StorageClient
생성자
| Queue |
QueueServiceClient의 인스턴스를 만듭니다. |
| Queue |
QueueServiceClient의 인스턴스를 만듭니다. |
상속된 속성
| account |
|
| url | URL 문자열 값입니다. |
메서드
| create |
지정된 계정 아래에 새 큐를 만듭니다. https://learn.microsoft.com/rest/api/storageservices/create-queue4 참조 |
| delete |
지정된 큐를 영구적으로 삭제합니다. https://learn.microsoft.com/rest/api/storageservices/delete-queue3 참조 |
| from |
QueueServiceClient의 인스턴스를 만듭니다. |
| generate |
공유 키 자격 증명을 사용하여 생성된 QueueServiceClient에만 사용할 수 있습니다. 전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI를 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다. https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조 |
| generate |
공유 키 자격 증명을 사용하여 생성된 QueueServiceClient에만 사용할 수 있습니다. 전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI에 로그인하는 문자열을 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다. https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조 |
| get |
스토리지 분석 및 CORS(원본 간 리소스 공유) 규칙에 대한 속성을 포함하여 스토리지 계정의 큐 서비스의 속성을 가져옵니다. https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties 참조 |
| get |
QueueClient 개체를 만듭니다. |
| get |
큐 서비스에 대한 복제와 관련된 통계를 검색합니다. 스토리지 계정에 대해 읽기 액세스 지역 중복 복제를 사용하도록 설정한 경우에만 보조 위치 엔드포인트에서 사용할 수 있습니다. https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats 참조 |
| list |
지정된 계정 아래의 모든 큐를 나열하는 비동기 반복기를 반환합니다. .byPage()는 비동기 반복 반복기를 반환하여 페이지에 큐를 나열합니다.
표식과 함께 페이징을 사용하는 예제:
|
| set |
스토리지 분석, CORS(원본 간 리소스 공유) 규칙 및 일시 삭제 설정에 대한 속성을 포함하여 스토리지 계정의 큐 서비스 엔드포인트에 대한 속성을 설정합니다. https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties 참조 |
생성자 세부 정보
QueueServiceClient(string, Pipeline)
QueueServiceClient의 인스턴스를 만듭니다.
new QueueServiceClient(url: string, pipeline: Pipeline)
매개 변수
- url
-
string
Azure Storage 큐 서비스를 가리키는 URL 문자열(예: "https://myaccount.queue.core.windows.net") AnonymousCredential을 사용하는 경우 SAS를 추가할 수 있습니다(예: "https://myaccount.queue.core.windows.net?sasString").
- pipeline
- Pipeline
newPipeline()을 호출하여 기본 파이프라인을 만들거나 사용자 지정된 파이프라인을 제공합니다.
QueueServiceClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)
QueueServiceClient의 인스턴스를 만듭니다.
new QueueServiceClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
매개 변수
- url
-
string
Azure Storage 큐 서비스를 가리키는 URL 문자열(예: "https://myaccount.queue.core.windows.net") AnonymousCredential을 사용하는 경우 SAS를 추가할 수 있습니다(예: "https://myaccount.queue.core.windows.net?sasString").
- credential
-
StorageSharedKeyCredential | AnonymousCredential | TokenCredential
AnonymousCredential, StorageSharedKeyCredential 또는 서비스에 대한 요청을 인증하는 @azure/identity 패키지의 자격 증명과 같은 TokenCredential 인터페이스를 구현하는 개체를 제공할 수도 있습니다. 지정하지 않으면 AnonymousCredential이 사용됩니다.
- options
- StoragePipelineOptions
HTTP 파이프라인을 구성하는 옵션입니다.
@azure/identityDefaultAzureCredential을 사용하는 예제:
import { DefaultAzureCredential } from "@azure/identity";
import { QueueServiceClient } from "@azure/storage-queue";
const account = "<account>";
const credential = new DefaultAzureCredential();
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
credential,
);
계정 이름/키를 사용하는 예제:
import { StorageSharedKeyCredential, QueueServiceClient } from "@azure/storage-queue";
// Enter your storage account name and shared key
const account = "<account>";
const accountKey = "<accountkey>";
// Use StorageSharedKeyCredential with storage account and account key
// StorageSharedKeyCredential is only available in Node.js runtime, not in browsers
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
sharedKeyCredential,
{
retryOptions: { maxTries: 4 }, // Retry options
userAgentOptions: {
userAgentPrefix: "BasicSample V10.0.0",
}, // Customized telemetry string
},
);
상속된 속성 세부 정보
accountName
accountName: string
속성 값
string
StorageClient.accountName에서 상속된
url
URL 문자열 값입니다.
url: string
속성 값
string
StorageClient.url에서 상속된
메서드 세부 정보
createQueue(string, QueueCreateOptions)
지정된 계정 아래에 새 큐를 만듭니다.
https://learn.microsoft.com/rest/api/storageservices/create-queue4 참조
function createQueue(queueName: string, options?: QueueCreateOptions): Promise<QueueCreateResponse>
매개 변수
- queueName
-
string
만들 큐의 이름
- options
- QueueCreateOptions
큐 만들기 작업에 대한 옵션입니다.
반환
Promise<QueueCreateResponse>
큐 만들기 작업에 대한 응답 데이터입니다.
deleteQueue(string, QueueDeleteOptions)
지정된 큐를 영구적으로 삭제합니다.
https://learn.microsoft.com/rest/api/storageservices/delete-queue3 참조
function deleteQueue(queueName: string, options?: QueueDeleteOptions): Promise<QueueDeleteResponse>
매개 변수
- queueName
-
string
삭제할 큐의 이름입니다.
- options
- QueueDeleteOptions
큐 삭제 작업에 대한 옵션입니다.
반환
Promise<QueueDeleteResponse>
큐 삭제 작업에 대한 응답 데이터입니다.
fromConnectionString(string, StoragePipelineOptions)
QueueServiceClient의 인스턴스를 만듭니다.
static function fromConnectionString(connectionString: string, options?: StoragePipelineOptions): QueueServiceClient
매개 변수
- connectionString
-
string
Azure Storage 계정의 계정 연결 문자열 또는 SAS 연결 문자열입니다.
[ 참고 - 계정 연결 문자열은 NODE.JS 런타임에서만 사용할 수 있습니다. ] 계정 연결 문자열 예제 -
DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS 연결 문자열 예제 - BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString
- options
- StoragePipelineOptions
HTTP 파이프라인을 구성하는 옵션입니다.
반환
지정된 연결 문자열의 새 QueueServiceClient 개체입니다.
generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)
공유 키 자격 증명을 사용하여 생성된 QueueServiceClient에만 사용할 수 있습니다.
전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI를 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다.
https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조
function generateAccountSasUrl(expiresOn?: Date, permissions?: AccountSASPermissions, resourceTypes?: string, options?: ServiceGenerateAccountSasUrlOptions): string
매개 변수
- expiresOn
-
Date
Optional. 공유 액세스 서명이 유효하지 않은 시간입니다. 지정하지 않으면 기본적으로 1시간 후로 설정됩니다.
- permissions
- AccountSASPermissions
SAS와 연결할 사용 권한 목록을 지정합니다.
- resourceTypes
-
string
공유 액세스 서명과 연결된 리소스 유형을 지정합니다.
선택적 매개 변수입니다.
반환
string
이 클라이언트가 나타내는 리소스에 대한 URI로 구성된 계정 SAS URI와 생성된 SAS 토큰이 뒤따릅니다.
generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)
공유 키 자격 증명을 사용하여 생성된 QueueServiceClient에만 사용할 수 있습니다.
전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI에 로그인하는 문자열을 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다.
https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조
function generateSasStringToSign(expiresOn?: Date, permissions?: AccountSASPermissions, resourceTypes?: string, options?: ServiceGenerateAccountSasUrlOptions): string
매개 변수
- expiresOn
-
Date
Optional. 공유 액세스 서명이 유효하지 않은 시간입니다. 지정하지 않으면 기본적으로 1시간 후로 설정됩니다.
- permissions
- AccountSASPermissions
SAS와 연결할 사용 권한 목록을 지정합니다.
- resourceTypes
-
string
공유 액세스 서명과 연결된 리소스 유형을 지정합니다.
선택적 매개 변수입니다.
반환
string
이 클라이언트가 나타내는 리소스에 대한 URI로 구성된 계정 SAS URI와 생성된 SAS 토큰이 뒤따릅니다.
getProperties(ServiceGetPropertiesOptions)
스토리지 분석 및 CORS(원본 간 리소스 공유) 규칙에 대한 속성을 포함하여 스토리지 계정의 큐 서비스의 속성을 가져옵니다.
https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties 참조
function getProperties(options?: ServiceGetPropertiesOptions): Promise<ServiceGetPropertiesResponse>
매개 변수
- options
- ServiceGetPropertiesOptions
속성 작업을 가져오는 옵션입니다.
반환
Promise<ServiceGetPropertiesResponse>
큐 서비스 속성을 포함한 응답 데이터입니다.
getQueueClient(string)
QueueClient 개체를 만듭니다.
function getQueueClient(queueName: string): QueueClient
매개 변수
- queueName
-
string
반환
새 QueueClient
사용 예:
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";
const account = "<account>";
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
new DefaultAzureCredential(),
);
const queueName = "<valid queue name>";
const queueClient = queueServiceClient.getQueueClient(queueName);
const createQueueResponse = await queueClient.create();
console.log(
`Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
);
getStatistics(ServiceGetStatisticsOptions)
큐 서비스에 대한 복제와 관련된 통계를 검색합니다. 스토리지 계정에 대해 읽기 액세스 지역 중복 복제를 사용하도록 설정한 경우에만 보조 위치 엔드포인트에서 사용할 수 있습니다.
https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats 참조
function getStatistics(options?: ServiceGetStatisticsOptions): Promise<ServiceGetStatisticsResponse>
매개 변수
- options
- ServiceGetStatisticsOptions
통계 작업을 가져오는 옵션입니다.
반환
Promise<ServiceGetStatisticsResponse>
작업 통계 가져오기에 대한 응답 데이터입니다.
listQueues(ServiceListQueuesOptions)
지정된 계정 아래의 모든 큐를 나열하는 비동기 반복기를 반환합니다.
.byPage()는 비동기 반복 반복기를 반환하여 페이지에 큐를 나열합니다.
for await 구문을 사용하는 예제:
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";
const account = "<account>";
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
new DefaultAzureCredential(),
);
let i = 1;
for await (const item of queueServiceClient.listQueues()) {
console.log(`Queue${i++}: ${item.name}`);
}
iter.next()사용하는 예제:
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";
const account = "<account>";
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
new DefaultAzureCredential(),
);
let i = 1;
const iterator = queueServiceClient.listQueues();
let { done, value } = await iterator.next();
while (!done) {
console.log(`Queue${i++}: ${value.name}`);
({ done, value } = await iterator.next());
}
byPage()사용하는 예제:
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";
const account = "<account>";
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
new DefaultAzureCredential(),
);
let i = 1;
for await (const page of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
for (const item of page.queueItems || []) {
console.log(`Queue${i++}: ${item.name}`);
}
}
표식과 함께 페이징을 사용하는 예제:
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";
const account = "<account>";
const queueServiceClient = new QueueServiceClient(
`https://${account}.queue.core.windows.net`,
new DefaultAzureCredential(),
);
let i = 1;
let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;
// Prints 2 queues
if (response.queueItems) {
for (const item of response.queueItems) {
console.log(`Queue${i++}: ${item.name}`);
}
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;
// Prints 10 queues
if (response.queueItems) {
for (const item of response.queueItems) {
console.log(`Queue${i++}: ${item.name}`);
}
}
function listQueues(options?: ServiceListQueuesOptions): PagedAsyncIterableIterator<QueueItem, ServiceListQueuesSegmentResponse, PageSettings>
매개 변수
- options
- ServiceListQueuesOptions
큐 작업을 나열하는 옵션입니다.
반환
페이징을 지원하는 asyncIterableIterator입니다.
setProperties(QueueServiceProperties, ServiceGetPropertiesOptions)
스토리지 분석, CORS(원본 간 리소스 공유) 규칙 및 일시 삭제 설정에 대한 속성을 포함하여 스토리지 계정의 큐 서비스 엔드포인트에 대한 속성을 설정합니다.
https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties 참조
function setProperties(properties: QueueServiceProperties, options?: ServiceGetPropertiesOptions): Promise<ServiceSetPropertiesResponse>
매개 변수
- properties
- QueueServiceProperties
- options
- ServiceGetPropertiesOptions
속성 작업을 설정하는 옵션입니다.
반환
Promise<ServiceSetPropertiesResponse>
속성 설정 작업에 대한 응답 데이터입니다.