sharu
sharu

Reputation: 71

DMSDK Transactions - Marklogic JAVA API

I wanted to ingest 3 documents into marklogic database using DMSDK. While ingesting I am creating an error in one of the document ingestion and hence the whole transaction gets rolled back.

I wanted to know whether the multiple update statements written in DMSDK which runs in a single transaction (batcher), is considered as a single transactional statement. Basically I wanted to check if the statements written inside DMSDK transaction (batcher) will be able to see the other statements written in the same transaction. For example, if there is statement s1 in the transaction t1 which ingests a document, can i write another statement s2 which will be able to query the document ingested by s1 within the same transaction t1 using DMSDK?

I observed we can do it using Xquery but notusing server side javascript since in serverside javascript it treats all the statements within a single transaction as a single statement. Can anyone please suggest if this is the same scenario with DMSDK as well by treating all the statements within a transaction as a single statement transaction?

Upvotes: 1

Views: 124

Answers (1)

ehennum
ehennum

Reputation: 7335

Each DMSDK batch executes in a single transaction. Different DMSDK batches execute in different transactions.

With respect to transactions in server-side code...

While it's true that XQuery has special syntax (the ; separator) for executing sequential transactions, the more typical approach is to use xdmp:invoke(), xdmp:invoke-function() or xdmp:eval() with different transaction isolation to execute child transactions. This approach provides more control.

The same functions -- xdmp.invoke(), xdmp.invokeFunction(), and xdmp.eval() -- are available in Server-Side JavaScript.

Hoping that helps,

Upvotes: 2

Related Questions