We have a utility for monitoring directories and taking actions when files appear in those directories. It's in java and takes the form of a standalone jar which launches several threads when started:
- One thread periodically (every minute or so) checks for new instructions regarding which directories to monitor.
- Another set of threads periodically checks each of the directories being monitored. New files are placed in a notification queue.
- Another set of threads service the notification queue and run actions for each new file.
Now, the powers that be want to reimplement this utility within JBPM. The main goal is to permit file arrival to start workflows within JBPM. Secondary goals are to make the process more highly available, and perhaps to simplify deployment by having it run inside Jboss rather than as a standalone utility.
I have past experience with WebSphere process server--IBM's BPM system--but JBPM is completely new to me. I'm struggling to see how to recreate this program as a set of JBPM processes, and it's not even clear to me that JBPM is the right tool for the low-level logic of reading directories and processing lists of files.
I could write a simple one-step business process that just calls into the entry point for the old monitor utility. With more work, I imagine I could decompose the old logic into a couple of different business processes calling each other. I have a hard time seeing the point, though. On a more practical level, the utility is supposed to start up automatically--without being called by anything--and I haven't been able to figure out how to do that for something deployed within jboss.
Should I be pushing back on this requirement to use JBPM? Or suck it up and get coding?