0
votes

Is there any way to call a xQuery Script stored in eXist which for instance uses transform:transform on a large number of files and let it run in the Background? Right now, I can call my script via the Browser and it will take several minutes - would be nice to have it run in the background. Is this possible?

---Edit

It seems that xQuery Tasks are always running in the background, there is no need to wait from them to finish when calling them via a Webinterface in eXist. So what I'm looking for is merely a way to forward to another url when a query is called.

1
Why not just change your .xq file to execute all of the transformations and avoid the complexity of one query forwarding ("calling back") to another URL? If you really want to trigger an HTTP request, you could use the hc:send-request function. See exist-db.org/exist/apps/fundocs/view.html?uri=http://expath.org/…. - Joe Wicentowski
My xq executes all Transformations, but when I call via my Webinterface (my eXist App) the browser just keeps on reloading – I’m looking for a way to call by xq and immediately redirect to another page. The xq exectution sometimes takes hours to complete. I’ll look into hc:send-request, thanks! - karkraeg
Trigger the transformation and redirect the browser at once. This is easy with the XQ ability to return more values: return (request:redirect-to(URI), transform:transform()). With this, the browser is redirected and the process runs ‘in the background’. - Honza Hejzl
Thanks @HonzaHejzl but when testing I’m getting this error: Cannot compile xquery: err:XPST0017 Function request:redirect-to() is not defined in module namespace: http://exist-db.org/xquery/request I can’t find any Info about this in eXist’s XQuery Function Documentation… - karkraeg
@kbecker87 Sorry, I it is response:redirect-to() The docs. - Honza Hejzl

1 Answers

0
votes

Can you explain what you mean by background? If you call the script it will run. If running the script makes exist unresponsive you need to increase its memory. You can run multiple scripts, and you can schedule a CRON job to execute a query at specific intervals. You can also execute a script via the REST endpoint, in case you don't want to use a browser?