azure-sdk-for-js/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_GetStatistics.ts

32 строки
811 B
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* @summary job queue crud
*/
import JobRouter, {
AzureCommunicationRoutingServiceClient
} from "@azure-rest/communication-job-router";
import * as dotenv from "dotenv";
dotenv.config();
const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || "";
// Get a router jobQueue's statistics
async function getJobQueueStatistics(): Promise<void> {
// Create the Router Client
const routerClient: AzureCommunicationRoutingServiceClient =
JobRouter(connectionString);
const entityId = "router-jobQueue-123";
const result = await routerClient.path("/routing/queues/{queueId}/statistics", entityId).get();
console.log("router jobQueue: " + result);
}
getJobQueueStatistics().catch(console.error);