-1

Does Azure function support Azure Cosmos DB conflict feed based trigger like how Azure function supports below Cosmos change feed trigger? If not why?

   public async Task RunAsync([CosmosDBTrigger(
        databaseName: "cars-island-eshop",
        collectionName: "Customer",
        ConnectionStringSetting = "CosmosDbConnectionString",
        CreateLeaseCollectionIfNotExists = true,
        LeaseCollectionName = "Lease",
        LeaseCollectionPrefix = "UpdateCustomerDataInOrder")]IReadOnlyList<Document> input, ILogger 
       log)
       {
         ..............
       }

1 Answers1

2

No there is no trigger mechanism for the conflict feed in Cosmos DB. You need to manually query it on a timer.

Mark Brown
  • 8,113
  • 2
  • 17
  • 21
  • Well, I can use timer based Azure function but that doesn't sounds like instantaneous solution but introduces delay in resolving conflicts as it is going to be pull based model and also polling for conflict feed each time even on no conflict situation, costs me extra charges. Any thoughts to overcome these shortcomings of using timer? – pingpong2020 Mar 20 '21 at 19:06
  • If you need immediate conflict resolution then use LWW using the timestamp or a numeric property (scoped at a document level) or use stored procs (scoped at the logical partition). If you're using the conflict feed you're choosing flexibility over speed because you can do anything you want to resolve conflicts. LWW and Merge sprocs happen as part of the commit but you give up flexibility. – Mark Brown Mar 21 '21 at 23:23