During my last project I created new filter and added Automatic stop to OSDelegatingFileTailingMessageProducer which i think are good to share.
My Requirement was to monitor a folder for new files and tail that file. A new file is created every 10 min or if the current file size reached 30 MB a new file is created.
So based on the above requirement i had to:
I needed a filter smiler to AcceptOnceFileListFilter but ignore file size , so i created AcceptOnceFileNameListFilter that do compare file name instead of complete file.
Another requirement was due to the fact that each 10 min a new file is created without being removed i had to stop the tailing process with 2 options :
- If the file has a known footer then check the line read and if it is the footer stop the process
- Assign a maximum timeout for the process if you are certain that it should be done in certain amount of time
If you think they are good addition , i will make them more general and do a pull request.