我试图一次将消息发送到多个主题,然后使用Azure Functions应用将其发送到Cosmos DB?任何想法如何做到这一点?

最佳答案

有关如何使用服务总线输出绑定的示例,请参见此处:https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#output---javascript-example

您应该能够同时为多个主题创建多个输出绑定(未进行测试)

{
    "bindings": [
        {
            //...
            "direction": "in"
        },
        {
            "name": "outputSbQueue1",
            "type": "serviceBus",
            "queueName": "testqueue1",
            "connection": "MyServiceBusConnection",
            "direction": "out"
        },
        {
            "name": "outputSbQueue2",
            "type": "serviceBus",
            "queueName": "testqueue2",
            "connection": "MyServiceBusConnection",
            "direction": "out"
        }
    ],
    "disabled": false
}


CosmosDB的输出绑定请参见此处:https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2#output---javascript-examples

关于javascript - 将消息发送到多个Service Bus主题,然后将其发送到cosmos db,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56270581/

10-11 15:00