samedi 20 janvier 2018

Design pattern for simple workflow

I am developing a java standalone application/framework. The application generates report based on data from database once a day, it's scheduled to run daily. The application has to be generic to support different reports. After some research I figured to store the meta data for each report in database. For e.g. report name, enabled, sql query which returns data for the report etc.

Each schedule job is associated with specify report (report id).

So briefly the workflow is Scheduled Job runs > Retrieves the meta data for specific report > Runs the sql query > FTP the report file > Email the report > End

There might be more steps added. And also depending on the step it might not need to successfully complete. For e.g. if the FTP fails, the flow should continue.

The current class which drives the flow is ReportService, which retrieves meta data, use FTP class and then Email class.

Since I want to make the framework extensible, the user can extend the ReportService class and transform the data retrieved, calls some other business service before continue with usual flow (ftp>email).

I am looking fo design patterns which will help me making the framework generic and easily extensible, specifically pattern to implement workflow in which if one of the steps fails, depending on the step the flow should terminate or continue.

Aucun commentaire:

Enregistrer un commentaire