xdmp.xaComplete( $forestID as String, $txn-id as String, $commit as Boolean, $remember as Boolean ) as null
Completes (commits or rolls back) a prepared XA transaction.
|$forestID||A forest ID.|
|$txn-id||The transaction ID.|
|$commit||Whether to commit or rollback. A value of true means commit.|
|$remember||Whether to remember the completion until explicitly forgotten.|
You should usually let the Transaction Manager handle commit or rollback of global transactions. This function is made available for unusual circumstances in which you need to heuristically complete the MarkLogic branch of a global XA transaction. For example, if contact with the Transaction Manager is lost for a long time.
xdmp.xaComplete(forest-id, txn-id, true, true); => Empty. The given transaction is committed and the outcome is remembered. xdmp.xaComplete(forest-id, txn-id, false, true); => Empty. The given transaction is rolled back and the outcome is remembered.