You are not logged in.
Pages: 1
Hello,
Suppose that I have a sqlite database on my linux server and deployed a mORMot based server (Exposing the sqlite database to the web using mORMot REST).
Is it possible that after sending a request to server, It process the request (manipulate data on the database ) and execute command or shell script after ??
Thanks.
Offline
Yes, just call the shell from the service code.
You can use RunProcess() from mORMotService.pas - it will work on all supported OS and compiler.
Of course, it won't be very efficient, since creating a process has a non negligeable cost.
Offline
Hi ab,
I need to synchronize data with an external api, a procedure that can last from minutes to hours depending on the amount of products the user has.
Due to this high time, I was thinking of running an external process to perform this job rather than using a thread on the server.
The request is received, it would return to the client that the procedure was started and execute the command.
In your opinion this would not be necessary? Could you leave this thread running "for hours" on the server?
Last edited by macfly (2019-05-11 14:29:26)
Offline
The RunProcess() has a wait/nowait option.
You can just launch an executable and let the REST server continue its work.
But I would rather use a dedicated background thread for communicating with the external API.
Offline
Thanks ab,
I'm going in this direction.
I created a TSQLWorker table where I monitor the execution of the process to pass to the client. The process notifies the progress to the server through an internal service.
Because they are long tasks, the progress query interval can be quite long.
Last edited by macfly (2019-05-11 15:25:16)
Offline
OOOOOOOOhhhhh SUPpppppppperrrrr !!
I love mORMot really.
Thnks you .
Offline
Yes, just call the shell from the service code.
You can use RunProcess() from mORMotService.pas - it will work on all supported OS and compiler.Of course, it won't be very efficient, since creating a process has a non negligeable cost.
Hello Ab,
Is this response, also Valid for RemoteDB access, I mean, I use the RemoteDB technique offred by mORMot, so How can I execute command(s) after the server receive some data from the Client.
ClientData => SynDBRemote(TSQLDBServerRemote) => + Save data in DB
+ ExecuteCmd
thanks you
Offline
Pages: 1