elsa-workflows / elsa-workflows/elsa-extensions
[FEAT] Add WatchFileSystem Activity
- Dominant language
- C#
- Stars
- 49
- Forks
- 48
- Avg merge
- 21h 35m
- Merged PRs (30d)
- 20
Description
## Feature Request
### Problem Overview
A common scenario workflow users come across is waiting for a file or folder in a directory to be created or changed before taking action.
### Proposed Solution
The solution would be to add a new activity that integrates the .NET [FileSystemWatcher](https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-io-filesystemwatcher) into a new `WatchFileSystem` activity that allows a workflow user to specify a path segment to watch which suspends the workflow until the watch conditions are satisfied, at which point the workflow is resumed.
#### Activity Inputs:
- **Path:** The path to the directory to watch for changes.
- **File Filter:** The filter string, used to determine what files are monitored in a directory. Supports a simplified set of regular expressions.
- **Event Type:** Dropdown selection of Changed, Created, Deleted, Renamed
- **Notification Types:** A dropdown selection of the type of changes to watch for. These values will come from the [NotifyFilters](https://learn.microsoft.com/en-us/dotnet/api/system.io.notifyfilters?view=net-9.0) enum. (Can this be a multi-select? Would it make sense?)
- **IncludeSubdirectories:** Checkbox indicating whether subdirectories within the specified path should be monitored.
- **Ignore Hidden Files:** Checkbox indicating whether hidden files within the specified path should be monitored.
- **Ignore Hidden Folders:** Checkbox indicating whether hidden folders within the specified path should be monitored.
#### Activity Outputs:
- Directory: The `Directory` reference of the `Path` being watched.
- File: The `File` reference matching the watch conditions.
### Use Cases
- Daily xml/json/csv/data files get dumped into a directory and I want to process them with Elsa when they become available.
- I need to wait for a file exist before a downstream activity or workflow can begin execution and this `WatchFileSystem` activity would provide suspension capability until the file exists.
Contributor guide
Assessment
This issue has not been assessed yet.