January 2, 2015 at 2:05 pm
i've got a three step task right now that uses best-guess timing:
a job sends a message to an external process, which in turn replaces 15 specific files in a network share.
the best guess is since it takes an average of 1 hour for the request to go through, a second job kicks off exactly one hour later; but all the files may or may not have been copied to the share.
then a best guess third job after that, thinks that it takes an hour for that step two to work, and kicks off one hour after that.
I'l like to eliminate the guesses, and put all the steps in a single job; but i'm having trouble with the filewatcher portion;
all the examples i've seen, either in .Net for a script task, or with powershell, seem to watch folders or one specific file.
I've seen one idea that is check 15 files with FileInfo for modified date, and uses thread.sleep until all the files that are expected return true, but i thought a filewatcher would be cleaner.
does anyone have a decent example they are familar with for multi file watching for modified dates?
Lowell
January 2, 2015 at 2:24 pm
Multiple (ie 15) filewatcher tasks? You could then use precedence constraints to ensure that the next step doesn't start until all 15 arrive?
Steve.
January 5, 2015 at 5:50 am
15 filewatchers, That's what i was originally thought i might have to do, and then i thought a script task that uses some code, that institutes a filewatcher would be cleaner looking.
i just hate the idea of 15 repetitively redundant code blocks that might be able to be done by a single, smarter codeblock instead.
and if someone ahs to add a sixteenth file in the future or something, yuck....
Lowell
January 5, 2015 at 7:44 am
Agreed, not overly pretty. You could try using the .net FileSystemWatcher class itself, so basically 'rolling your own' specific FSW. A reasonable example for watching for multiple files is here -> http://stackoverflow.com/questions/6943908/using-filesystemwatcher-with-multiple-files
Steve.
January 5, 2015 at 8:02 am
I'd try to use one Filewatcher task, with a filter, but kick off a job with logic. If it's a new file, tick a table somewhere and note this. Have the FW continue to kick it off all the time a new file arrives.
When the job ticks the 15th (or whatever) field/box/table, then execute your process.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply