Database Forwarding Agent Transaction Behavior

The agent utilizes a Transaction ID, unique for each batch, in two ways.

  1. To make sure that inserted (distributed) rows are removed in case the batch is cancelled. This to avoid duplicated rows. To handle this, the agent inserts its batch Transaction ID in the assigned Transaction ID column. If the batch is cancelled, all rows matching the batch Transaction ID will be removed again.

    If a stored procedure is used to populate the table, the configured Cleanup SP must be able to do the same, or something similar, to avoid duplicates. For further information and an example of a cleanup stored procedure, see Cleanup Stored Procedure in Tables and Stored Procedures.
     

  2. To make sure that a potential Database collection agent does not collect rows from the target table, before the current batch is closed. To handle this, the agent populates a pending transaction table with the current Transaction ID, database and table name in the beginning of the batch and removes the entry in the end of the batch. For a detailed description of this behavior, see Inter-Workflow Communication, Using Database Agents.

Emits

This agent does not emit anything.

Retrieves

The agent retrieves commands from other agents and based on them generates a state change of the file currently processed.

Command

Description

Command

Description

Begin Batch

Retrieves a Transaction ID and inserts an entry in the pending transaction table.

End Batch

Deletes the pending Transaction ID row.

Cancel Batch

Removes the distributed rows with the current Transaction ID or calls the configured Cleanup SP. The pending Transaction ID row is deleted.