We are developing an application which needs to process huge file stored in DB in multiple rows. The processing can be split across multiple JMS clients so that each client gets its own share to work with and do the processing independently. How is it possible to determine whether all JMS clients have completed their part ? We need to trigger another step in the processing flow once all JMS clients completes their task. We are using MDBs as JMS clients.
Infact we are collecting the individual task status on Database. But there’s no master as such. The flow looks like this.
-
One part of the system receive file in chunks and keep in DB.
-
The next step logically splits this file into N partitions and send the Meta data of the partitions as JMS Messages.
-
And then the JMS clients process their part of the file, and when they are finished they update the status of the task on another table in DB.
But how is it possible to trigger the next step ? How will one JMS client know that all other clients have finished their parts. Or how can I employ a master here ?
You can do it on application level. Each worker should create notification when it has completed its task. You can either push notification to special JMS queue or to store it in database. This depends on your application. The notification should contain the task ID created my manager that creates task. So other component (or manager) can check whether all created task have been terminated.