Azure-functions-host: New Feature: Blog Trigger or Storage Queue Trigger on File Deletion

Created on 21 Jun 2017  路  2Comments  路  Source: Azure/azure-functions-host

Add a blobTrigger or Storage Queue trigger on File deletion. For this to be useful, you'd also have to implement #1611 so it was possible to differentiate between the two.

We're just about done implementing a Debian Repository in Azure functions. This is extremely useful to us for our low-volume repositories for distributing our training content. It works great on the adding of new deb files, since all we need to do is drop it in a folder and all the needed meta-data is automatically updated.

However, we currently have to manually remove data from our Azure Functions since there is no trigger on a file deletion. This is not ideal, and we'd really like it to be automatic. I've got to think there are a lot more use cases where triggers on deletions would also be very useful.

We also have other ideas to use Azure Functions to help monitor and keep track of change management for stored configuration files. However, again, tracking deletions would be a vital component of that.

Repro steps

  1. Create a Azure Function Blog Trigger or Storage Queue Trigger on a given path.
  2. Delete a file in that path.

NOTE: You do not receive any type of trigger or notification.

Expected behavior

There is a way to cause a trigger when a file is deleted.

Actual behavior

No notification is received when a file is deleted.

Known workarounds

Scan the entire file system periodically. This is not actually practical with the planned number of files.

Most helpful comment

Azure Storage now supports integration with Event Grid, and this is a good solution to detecting and reacting to deletes:
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-event-overview

@JanKinable You will need to file this as a feature request against the Cosmos DB change feed as this powers the cosmos trigger in functions. The documentation on the change feed is here:
https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed

Note this comment:

The change feed includes inserts and update operations made to documents within the collection. You can capture deletes by setting a "soft-delete" flag within your documents in place of deletes. Alternatively, you can set a finite expiration period for your documents via the TTL capability, for example, 24 hours and use the value of that property to capture deletes. With this solution, you have to process changes within a shorter time interval than the TTL expiration period.

All 2 comments

please add Cosmos DB delete trigger to the scope.

Azure Storage now supports integration with Event Grid, and this is a good solution to detecting and reacting to deletes:
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-event-overview

@JanKinable You will need to file this as a feature request against the Cosmos DB change feed as this powers the cosmos trigger in functions. The documentation on the change feed is here:
https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed

Note this comment:

The change feed includes inserts and update operations made to documents within the collection. You can capture deletes by setting a "soft-delete" flag within your documents in place of deletes. Alternatively, you can set a finite expiration period for your documents via the TTL capability, for example, 24 hours and use the value of that property to capture deletes. With this solution, you have to process changes within a shorter time interval than the TTL expiration period.

Was this page helpful?
0 / 5 - 0 ratings