.net - Scheduler tasks registration design -
i have architectural question.
let's have scheduler , number of subsystems. of these subsystems can have actions, should able executed scheduler.
we have 2 ways implement registration of scheduler tasks.
one way have method in each subsystem, called registerschedulertasks
, called bootstrapper in application during application start. in method call static scheduler
class this:
void handler1(){ } void handler2(){ } void registerschedulertasks() { scheduler.registerhandler( "e1", handler1 ); scheduler.registerhandler( "e2", handler2 ); }
"e1"
, "e2"
names of tasks, have corresponding settings in scheduler config.
another approach use, example, mef. each subsystem export set of ischedulertask
s, , not register these tasks imperatively. , on other side of application have schedulertasksregistry
, import set of these ischedulertask
s.
in approaches have map in config, contain scheduling timeline each task, identified in both approaches name.
i inclining second approach, not have enough arguments it. argument first approach means higher static coupling of subsystems.
am right, second approach better? arguments of these approaches?
here use 'chain of responsability' pattern. pattern
'avoids coupling sender of request receiver giving more 1 object chance handle request. chain reciving object , pass request along chain until object handles it.'
an example of use of pattern can found here.
i hope helps.
Comments
Post a Comment