Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to guarantee at least once delivery with Azure Function with Cosmos DB trigger

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 ?

like image 810
kyarbles Avatar asked May 08 '18 15:05

kyarbles


1 Answers

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

like image 165
Mikhail Shilkov Avatar answered Sep 20 '22 23:09

Mikhail Shilkov