jeudi 21 mars 2019

Spring Batch Generic Job Desing

I'm having trouble finding the correct answer to this question. When using Spring Batch framework is it ok to try to solve all the batch processing in one generic job?

For instance, I'm trying to process different txt files (files with different structure) with the same job.

My idea is to run the job from a scheduler passing to it a String with the name of the file I want to process. Then, I would be able to instantiate an object related to the file to be processed, and this object will be passed from one step to the other and in each step it would be able to answer questions related to its delimiters, fields names, insert statement, so on and so forth.

On the other hand, I could write a job for each file, but a lot of code would be repeated.

Aucun commentaire:

Enregistrer un commentaire