【问题标题】:Send Messages from service bus topic to another as batches using IAsyncCollector in Azure Functions keeps retries even after message received使用 Azure Functions 中的 IAsyncCollector 将消息从服务总线主题批量发送到另一个主题即使在收到消息后也会继续重试
【发布时间】:2022-11-25 13:56:06
【问题描述】:
我有一个 azure 函数,它从服务总线主题接收消息并使用 IAsyncCollector 发送到另一个。即使在另一个主题中收到消息后,它也不会从发件人主题中删除并继续重试。知道为什么会这样。还想获得一些使用 IAsyncCollector 的样本。或者在 azure 函数中有没有其他方法可以批量发送消息?
【问题讨论】:
标签:
c#
service
azure-functions
azureservicebus
azure-servicebus-topics
【解决方案1】:
如果消息在收到时未完成,通常会发生这种情况。默认情况下,如果代码成功执行,Azure Function 会自动完成消息。通过将 AutoComplete 设置为 false 检查您是否没有覆盖自动完成,并且在使用 IAsyncCollection 将消息转发到目的地后函数执行期间没有异常,因为这两者中的任何一个都会导致消息被多次接收和发送。