Hi Danny,
That's not how the File Watcher plugin we provide works.
The poll interval set in the JiwaPluginSchedulerService.exe.config applies to the frequency the service looks for schedules to be run. When due to run, it will invoke the Execute method in the ScheduledExecutionPlugin class of each plugin which has a schedule attached that is due or overdue to be run.
The standard File Watcher Plugin in Jiwa
doesn't use poll intervals - you'll note the Execute method in there is empty.
So how does it know when a file appears in a watch folder? The OnServiceStart method of the File Watcher Plugin tells the operating system that it wants to be notified as soon as a file appears - no polling - this is achieved by the following code:
- Code: Select all
FileSystemWatcher = New FileSystemWatcher
FileSystemWatcher.Path = Me.WatchFolder
FileSystemWatcher.NotifyFilter = (NotifyFilters.LastWrite Or NotifyFilters.FileName)
FileSystemWatcher.Filter = "*.*"
FileSystemWatcher.EnableRaisingEvents = True
AddHandler FileSystemWatcher.Created, AddressOf OnCreated
This tells the operating system (via the .Net framework) to invoke the OnCreated method of the plugin whenever a file is created in the watch folder.
I can see how you were misled - the "JiwaPluginSchedulerService" is being used to start watching a folder on service start, and not using any scheduling - we opted to do this to simplify things and not introduce another dedicated service to watch folders, when we could just use the JiwaPluginSchedulerService.
If you really want to only perform actions on files in a folder based on a schedule, then you can do that by moving some code to the Execute method of the ScheduledExecutionPlugin class from the OnServiceStart method. You'll need to remove the code which I showed above.
It'll take a little bit of refactoring, but you'll mostly be deleting and moving chunks of code - so not too much effort involved to do what you want.
Mike