Recording

With recording feature you can record all the data pass between components during execution.

Record Persist Driver

This driver is use by the job to save components data. It a class implement the interface:

interface TxRecordPersistAdapter {
/**
   * Insert an execution into storage. The pair executeUuid:sequence consider the execution ID.
   * if executeUuid:sequence exist then throw an exception.
   *
   * It should be possible to retrieve all executions of a specific job.
   *
   * @param {TxRecordIndexSave} index - encapsulate properties about the execution.
   * @param {TxRecordInfoSave} info - a wrapper around tasks and reply data.
   */
  insert(index: TxRecordIndexSave , info: TxRecordInfoSave): void;

  /**
   * Update an exist execution of a specific job. The pair executeUuid:sequence consider the execution ID.
   * if executeUuid:sequence is not exist then throw an exception.
   *
   * @param {TxRecordIndexSave} index - encapsulate properties about the execution.
   * @param {TxRecordInfoSave} info - a wrapper around tasks and reply data.
   */
  update(index: TxRecordIndexSave , info: TxRecordInfoSave): void;

  /**
   * Delete an execution according to its Id
   * If executionId.sequence > 0 then delete a specific execute (according to its sequence)
   * if executionId.sequence == 0 then delete all steps of one job execute (all executions of a specific job run).
   * this is similar to executeUuid:*.
   *
   * @param {TxJobExecutionId} executionId
   */
  delete(executionId: TxJobExecutionId);

  /**
   * Read a specific execution. Should return exection array according to executionId
   *
   * If executionId.sequence > 0 then get a specific execute (according to its sequence)
   * if executionId.sequence == 0 then get all steps of one job execute (all executions of a specific job run).
   * this is similar to executeUuid:*.
   *
   * @param {TxJobExecutionId} executionId - a pair of executeUuid:sequence
   * @returns {Promise<TxRecordRead[]>}
   */
  asking(executionId: TxJobExecutionId): Promise<TxRecordRead[]>;

  /**
   * Close connection to storage.
   */
  close();
}

So to use recording you need:

  1. Call to

    TxJobRegistry.instance.setRecorderDriver(recorder);

    where 'recorder' is a class implement TxRecordPersistAdapter.

  2. Turn on record: true on TxJobExecutionOptions, for example:

job.execute(new TxTask({
    method: 'create',
    status: ''
  },
  {something: 'more data here'}
  ),
  {
    persist: {ison: false},
    execute: {record: true}
  } as TxJobExecutionOptions
);

This will record all your components data

Last updated