We currently have a few AzureFunctions that use an Azure CosmosDB trigger. As I understand, this uses a ChangeFeed
generated by CosmosDB that generates the input
elements for the triggered function.
My question is: If I disable
the Azure Function with the CosmosDB trigger in Azure Portal, perform a large number of changes to Items
in our CosmosDB, and then re-enable
the given AzureFunction, will the function pick up on all the changes, or will these changes simply not get processed?
Also, in case that the function doesn't, in fact, process the changes that were made while it was disabled, will I run into any issues processing changes that are made to those same items in the future?
The reason I'm asking is because we have a situation in which we need to make batch changes to a very large number of Items in our CosmosDB, but these changes don't require the AzureFunction in question to execute. As a matter of fact, we would really rather the function didn't execute to avoid overloading other services.
Thanks!
The CosmosDBTrigger will continue from when it was disabled and will report the changes.
When it's re-enabled, it will use the Continuation stored in the Leases that was last updated around the time it was disabled and that Continuation will allow it to pick-up any changes in-between. The Continuation contains the point in time of the last processed batch, so when re-enabled, it will use that to pick up any changes that happened after, including when it was disabled.
This is assuming you do not change any configuration when you re-enable it and you do not delete the Leases container and that there was at least 1 batch of changes processed before you disabled it (so there was a Continuation saved in the leases).
If you want the Function to skip those changes, delete the Leases before re-enabling and make sure you do not have StartFromBeginning
set to true
on the Trigger attributes.