7
votes

I have a Cosmos DB trigger for an Azure function. I want to flatten and write some data from the incoming Document(s) to an (Azure) SQL Server.

What is a way to guarantee at least once delivery?

I looked at https://hackernoon.com/reliable-event-processing-in-azure-functions-37054dc2d0fc which gives some options in the case of an Azure Function triggered by an Event Hub event, but I am not sure if the same applies for the CosmosDB changefeed that causes the trigger to fire.

On the Cosmos DB Change Feed site https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed it states:

Each change to a document appears exactly once in the change feed, and clients manage their checkpointing logic. The change feed processor library provides automatic checkpointing and "at least once" semantics.

Does that mean that it implements the same (or something similar to) the checkpoint system from Event Hub?

Does the circuit breaker pattern work the same way if applied to this flow of a CosmosDB trigger to an Azure Function as detailed at the end of https://hackernoon.com/reliable-event-processing-in-azure-functions-37054dc2d0fc ?

1
both azure storage queue and azure service bus queues gurantee at-least-once delivery, so post a message on any one of them and process it asynchronously using thatharishr
With this option how would an unsuccessful delivery in an Azure Function be communicated back to Service Bus?kyarbles
you have to mark message as success or failed for unsuccessful delivery to be communicated, but answer from Mikhail look better than this optionharishr

1 Answers

5
votes

Azure Functions Cosmos DB trigger is based on Change Feed processor library. You will get at-least-once out of the box.