xdmp.transaction( [txn-name as String], [host-id as (Number|String)] ) as Sequence
Returns the transaction ID for the current transaction, or transaction IDs for all transactions with the given name.
Parameters | |
---|---|
txn-name | An optional transaction name. |
host-id |
An optional host ID, for retrieving the transaction ID of a named
remote transaction. Default: The current host (xdmp:host() ).
|
When called with no parameters, this function returns the transaction ID of the current transaction on the local host. When called with a txn-name, the transaction ID for the named local or remote transaction(s) is returned.
Transaction names need not be unique. This function will return multiple transaction IDs if more than one transaction matches the parameters.
To retrieve the transaction ID of a named remote transaction, supply a host-id. If host-id is unknown or MarkLogic Server is not online on that host, an exception is raised.
If no matching transaction exists, an empty sequence is returned.
xdmp.transaction(); => The transaction ID for the current transaction on the local host.
xdmp.transaction("myNamedTransaction"); => The transaction ID for "myNamedTransaction" on the local host.
xdmp.transaction("myNamedTransaction", xdmp.host("some-host.marklogic.com")); => The transaction ID for "myNamedTransaction" on the remote host some-host.marklogic.com.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.