TxJob

  • A class able to store several components and execute them as a chain.

  • First task send to the first component, it's reply send to the second component and so on.

IMPORTANT: after finishing using a job to MUST call to release method on the job otherwise you will suffer memory leaks as well as un necessary callbacks calling.

For example a job may looks like that:

import { TxMountPointRegistry } from '../src/tx-mountpoint-registry';
 
class Names {
  static GITHUB_GIST_C1 = Symbol('GITHUB_GIST_C1');
  static GITHUB_GIST_C2 = Symbol('GITHUB_GIST_C2');
  static GITHUB_GIST_C3 = Symbol('GITHUB_GIST_C3');
}
 
let job = new TxJob(); // or create througth the TxJobRegistry
 
job.add(TxMountPointRegistry.instance.create(Names.GITHUB_GIST_C1));
job.add(TxMountPointRegistry.instance.create(Names.GITHUB_GIST_C2));
job.add(TxMountPointRegistry.instance.create(Names.GITHUB_GIST_C3));
 
job.execute(new TxTask(
  'create',
  '',
  {something: 'more data here'})
);

Last updated