Using a Job
Define and run a set of components.
To construct a set of components running one after the other you can use the Job class.
First create:
let job = new Job('job-1')
Then add some component to it by using add method:
job.add(TxMountPointRegistry.instnace.get(<component-name>)
Finally you can run by execute | step | continue methods to launch the execution.
Execute Jobs methods
execute - run the all component one after the other.
continue - continue running the jobs from where it stoped, usually this is relevant when job rebuild after serialization.
TxJob Functionality
execute - run the components one after the other
option: persistence - (toJSON / upJSON) before every component activation serialize the job into a persistence so it can recover and continue from the exact same place.
option:until - run until certain component and stop. the execution can resume with execute / continue and step methods
option:record - save the data pass between components so it can use for debugging and regression tests.
continue - run a job right from the same place where is stop.
step - run the job in single step. when each step is completed an even will rise indicate to complete.
toJSON / upJSON - and serialize / desalinize methods.
Error handling - if some component has an error it reply through the tasks mountpoint error channel. then the job hold it's execution and start running error sequence on all the called components.
TxJob events
TxJob send two events isCompleted and isStopped.
isCompleted - is send when all components where executed. use job.getIsCompleted().subscribe(..);
isStopped - on single step, after each step is completed. use job.getIsStopped().subscribe(..);
onComponent - notify on every reply from a component. use job.getOnComponent().subscribe(..);
Last updated