Have you considered inserting process-me.xml in a separate eval with an
option of <isolation>different-transaction</isolation> to ensure it is
available before when inserting cpf-init.xml?
Wayne.
On Mon, 2008-10-27 at 11:29 -0500, Strawn, Shane wrote:
> Hello,
>
> I have a somewhat convoluted issue to describe so I'll try to make
> sense:
>
> I have a Content Processing Framework process which watches a
> directory for a file to be dropped on it. This is a different
> database than my main content database.
>
> I have an xquery module which at the same time inserts a document into
> the content database, and the above file into the CPF database in an
> eval, like so:
>
> xdmp:document-insert( "process-me.xml", <data>…</data>)
> …
> xdmp:eval('xdmp:document-insert( "cpf-init.xml",
> <target-uri>process-me.xml</target-uri>)', $options (:
> setting db to content :) )
>
> Now, since these are in different dbs, it sometimes occurs where the
> CPF process will look for "process-me.xml" on the content db but not
> find it, because it is not finished document-inserting. I thought it
> should complete the doc-insert before moving on to the eval in the
> module, but it apparently doesn't due to the separate-transaction
> nature of the situation?
>
> I would like to find a way to loop or wait until my doc is fully
> inserted within xquery, rather than the more complex tasks of
> modifying the CPF pipeline or changing the interface to add another
> click-through after the doc is inserted, if possible. But I'm not
> sure how to accomplish this or if it's realistic.
>
> I've tried some (probably) stupid things such as:
>
> Killing a set amount of time with a statement like
> let $timekill := for $a in (1 to 10000000) return ()
> …but this seems unreliable, and a waste of time if it doesn't need it;
>
> Or a recursive function like
> define function check-doc-exists($uri as xs:string) {
> if ( fn:exists(fn:doc($uri)) ) then fn:true() else
> check-doc-exists($uri) }
> …but this gives me Stack Overflow within seconds, or if I put my
> timekiller in it, it never finds the doc even if it inserts while it
> is running.
>
> Is there something I can do here to create a loop which runs until it
> can find the document? Am I misunderstanding what is happening with
> the transaction? Just how wrong are my above ideas?
>
> Thanks in advance for any guidance.
>
> Shane Strawn
> Wolters Kluwer Health
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general