Run undo sequence on previous execute / continue. The undo send undo message to each already executed component in forward or backward order.
The component register on the undo message as:
this.mountpoint.undo().subscribe(
(task) => {
logger.info('[C2Component:undo] got task = ' + JSON.stringify(task, undefined, 2));
this.method = task['method'];
// just send the reply to whom is 'setting' on this reply subject
this.mountpoint.reply().next(new TxTask('undo from C2', 'ok', task['data']))
}
)
For example if the chain including C1, C2, C3. After the execution, calling to undo with backward order will initiate a sequence of undo call to each component in reverse order, C3, C2, C1.
usage
let job = new TxJob(); // or create througth the TxJobRegistry
job.add(TxMountPointRegistry.instance.get('GITHUB::GIST::C1'));
job.add(TxMountPointRegistry.instance.get('GITHUB::GIST::C2'));
job.add(TxMountPointRegistry.instance.get('GITHUB::GIST::C3'));
job.execute(new TxTask(
'create',
'',
{something: 'more data here'})
);
job.undo(backword);