File Pickup and Retry Logic

If the file system watcher event provider fails to read an event file, the event provider can add the file to a queue and then process the file at a later time. This topic describes the file system watcher file pickup and retry logic.

The File Queue

When the Windows service or application that runs the file system watcher event provider is started and the event provider is enabled, the file system watcher event provider adds all .xml files it has permission to read to a queue. Queuing the files prevents the buffer in the FileSystemWatcher class from filling, which could prevent files from being processed.

As new .xml files are added, these files are processed immediately. New files are added to the queue only when the event provider starts, or if there is a failure when attempting to process a file.

The file system watcher event provider attempts to process files in the queue on a schedule you specify when you define the event provider. For each file in the queue, the file system watcher event provider attempts to read the data from the file. When the event provider successfully reads and submits the data to the application, the file is removed from the queue.

Note that one thread is used for retry attempts. Notification Services processes one retry attempt at a time (which can include multiple files); subsequent retry attempts are skipped until the retry attempt is complete.

Locked and Inaccessible Files

If a file is locked when the file system watcher event provider attempts to read the data, the event provider leaves the file in the queue and increments a counter for the file. The event provider retries the file on the schedule you specify until a retry attempt limit is reached.

If a file's security setting does not allow the file system watcher event provider to access the file, the file is not added to the queue. Instead, Notification Services will watch the file for security changes. When a security change occurs, the file is added to the queue.

See Also

Concepts

File Validation
Defining a File System Watcher Event Provider

Other Resources

File System Watcher Event Provider
Standard Event Providers
Defining Event Providers

Help and Information

Getting SQL Server 2005 Assistance