简体   繁体   English

使用Azure函数将多个代理消息输出到Azure服务总线主题

[英]Output multiple Brokered Messages to an Azure Service Bus Topic(s) with Azure Functions

Is there a way you output multiple Brokered Messages to an Azure Service Bus in Azure Functions? 有没有一种方法可以将多个代理消息输出到Azure Functions中的Azure服务总线? by default you can output a single Brokered Message but not multiple. 默认情况下,您只能输出一个代理消息,但不能输出多个。

Currently using the SDK to do this but wondered if there is a way you can do this using the output... 当前使用SDK执行此操作,但想知道是否可以使用输出来执行此操作...

Thanks 谢谢

As per the documentation on ServiceBus output bindings: 根据有关ServiceBus输出绑定的文档:

For creating multiple messages in a C# function, you can use ICollector<T> or IAsyncCollector<T> . 要在C#函数中创建多个消息,可以使用ICollector<T>IAsyncCollector<T> A message is created when you call the Add method. 当您调用Add方法时,将创建一条消息。

Here is a simple example of using ICollector (also directly from the docs): 这是一个使用ICollector的简单示例(也直接来自文档):

public static void Run(TimerInfo myTimer, TraceWriter log, ICollector<string> outputSbQueue)
{
    string message = $"Service Bus queue message created at: {DateTime.Now}";
    log.Info(message); 
    outputSbQueue.Add("1 " + message);
    outputSbQueue.Add("2 " + message);
}

I personally find that all of the supported input/output bindings are well documented and examples are readily available at the link I've shown here. 我个人发现,所有受支持的输入/输出绑定都有详细的文档说明,并且在我在此处显示的链接中可以轻松找到示例。 Just pick the appropriate binding you're working with (if it's something other than Service Bus) 只需选择您正在使用的适当绑定(如果不是Service Bus,则选择其他绑定)

Also, Functions is built on top of the WebJobs SDK; 此外,Functions是在WebJobs SDK的基础上构建的; so if you can do a binding in the SDK, you can do the same thing in Functions (with a few corner case exceptions). 因此,如果您可以在SDK中进行绑定,则可以在“函数”中执行相同的操作(有一些例外情况)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为Microsoft Azure Service Bus代理消息实现SendBatchAsync - Implementing SendBatchAsync for Microsoft Azure Service Bus Brokered Messages 从 Azure function 向服务总线主题发送批处理消息 - Send batch messages to Service Bus topic from Azure function 如何处理不带锁定令牌的Azure服务总线代理消息? - How to process azure service bus brokered message without lock token? 使用代理消息在门户中测试Azure功能服务总线触发器 - Testing an Azure Function Service Bus Trigger in the Portal with a Brokered Message SubscriptionClient.RegisterMessageHandler() 是否在 Azure 服务总线中使用“代理连接”? - Is SubscriptionClient.RegisterMessageHandler() Using 'Brokered Connections' in Azure Service Bus? Azure服务总线主题体系结构 - Azure Service Bus Topic Architecture 如何使用 Azure Functions 将数据发送到服务总线主题? - How to send data to Service Bus Topic with Azure Functions? 是否可以收听具有多个 azure 功能的服务总线? - Is it possible to listen to a service bus with multiple azure functions? 使用 Azure 中的 IAsyncCollector 将消息从服务总线主题批量发送到另一个主题即使在收到消息后功能也会保持重试 - Send Messages from service bus topic to another as batches using IAsyncCollector in Azure Functions keeps retries even after message received Azure Service Bus - 循环到多个服务的主题 - Azure Service Bus - Round Robin Topic to Multiple Services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM