Design Options when FileWatcher is Needed in Middle of Process
We are looking at automating a user process, and I have some uncertainties about what would be the best design. First here are the basic characteristics of the proposed RPA process.
- Runtime will be OpenSpan 8.0.1103.
- It will be a server bot that will be scheduled to run 3 to 4 times per day.
- First step will be to interrogate system A for a dataset
- Dataset will be submitted to system B
- 3-5 minutes later, system B will deposit a file in a designated folder
- System C will then consume the above file for further processing.
I can think of 3 design options:
1) A Pega (OpenSpan) automation solution will begin, gather and submit dataset to system B. It will then start a FileWatcher, subscribe to it events, and remain dormant while waiting for output from system B. Once it receives the event, Pega automation will proceed with the rest of process outlined above.
2) FileWatcher will be a separate process that would always be running. Pega automation will be initiated by scheduled task, and then shut down after submitting data to system B. When FileWatcher detects creation of new file, it will restart the same Pega automation solution, but with different start "arguments", so as to use a different flow of logic.
3) FileWatcher will be a separate process that can always be running. There will be two Pega automations -- one for gather data and submitting to system B, and the other for processing the file returned by system B
What would be the best approach of the 3 design options above? Or, is there another option altogether that would be better?
I would recommend option 3. While you won't have one bot to complete each work item, it will be much more efficient to have bots be working during that 3-5 minute gap rather than waiting in an idle state. You wouldn't really need a FileSystemWatcher for the second bot though. It could just process all of the files in the directory and constantly be checking for new files. That would alleviate you having to do any kind of locking or anything regarding the FSW events firing in the middle of a process.