Search code examples
c#serviceazure-functionsazureservicebusazure-servicebus-topics

Send Messages from service bus topic to another as batches using IAsyncCollector in Azure Functions keeps retries even after message received


I have an azure function which receives messages from service bus topic and send to another using IAsyncCollector. Even after the message received in another topic it's not removed from the sender topic and keep retrying.Any idea why it is happening. Also would like to get some samples to use IAsyncCollector. Or is there any other way in azure function I can send messages in batches?


Solution

  • Often this would happen if messages are not completed when received. By default, Azure Function would auto-complete messages if the code executes successfully. Check that you don't override the auto-completion by setting AutoComplete to false and that there is no exception during function execution after messages are forwarded to the destination with IAsyncCollection, as either of these two would cause the messages to be received and sent multiple times.