Hi Marc,
I actually think this could be done "manually" using RestXQ.
You could maybe with something like this:
client issues request to start a long running job: 1) restxq/start/long-running-job -> returns job id 'Foo'
Every n-seconds the client asks: 2) restxq/is-job-running?job-id=Foo -> either redirects to restxq/is-job-running?job-id=Foo iff job 'Foo' is still running -> or redirects to restxq/the-job-is-done iff job 'Foo' has stopped running
Obviously this kind of polling is neither an asynchronous nor the most beautiful (yet, at the moment the only) way to do it.
Personally I'd like to see support for http://www.html5rocks.com/en/tutorials/websockets/basics/ Websockets, this way RestXQ could notify the client once something is finished. This would be true async communication and feel a lot better to deal with.
More opinions on this topic are very welcome :-)
Best Michael
On 15 Jul 2014, at 17:21, Marc van Grootel wrote:
How would you implement an async REST pattern? I don't remember having seen anything that makes me do this using plain XQuery. Does this mean the only way to tackle this would be via Java and events maybe?
I would post to a URL, this URL would accept the post and return a temporary URL where I can check the status of my request, then once it's ready this temp URL will redirect me to the location of the real resource. That's the gist of the async REST pattern that I would like to implement.
What would be the best approach to experiment with this?
--Marc