I have x number of worker classes which all implement a specific interface, i have a job descriptions
Each job description States the different worker classes that should execute to complete the job
Am I smelling a strategy pattern here?
All workers share some configuration data so I think I should have a seperate configuration classes that I can be passed into the constructor at worker creation
AM I walking down the right path?
EDIT
more high level details
- the job description specifies the different workers that needs to run to produce a sample file.
- each worker deals with a specific set of data domains
- all workers share the same output generation class to produce file(s) that are structurally same.
- there can be y number of job definitions and x number of workers so
y(1) uses x(1),x(2),x(3)
y(2) uses x(2),x(3),x(4)
i could have a JobFactory that returns a collection of the required worker classes and then iterate through the collection while invoking the worker execute method.
just looking for more ideas/opinions.
5
The design that springs to mind for me is to have a Job
class, which holds the recipe for the job and a collection of abstract Worker
instances.
To create the concrete workers required by the recipe, I would use a WorkerFactory
(creating one worker per request).
The responsibility of the Job
class is to create the string of workers needed for a job and to execute those workers.
2