我试图一次将消息发送到多个主题,然后使用Azure Functions应用将其发送到Cosmos DB?知道怎么做吗?
答案 0 :(得分:2)
有关如何使用服务总线输出绑定的示例,请参见此处:https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#output---javascript-example
您应该能够同时为多个主题创建多个输出绑定(未测试)
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { StorageManagementClient, StorageManagementModels, StorageManagementMappers } from "@azure/arm-storage";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new StorageManagementClient(creds, subscriptionId);
client.operations.list().then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
CosmosDB的输出绑定,请参见此处:https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2#output---javascript-examples