#1 2017-05-31 14:52:46

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

Return in callback

Hi mORMot community,

I'd like to call a service similar to this with CallbackGetResult

procedure TSQLRestServerDBCustomLI.SimpleButLong(Ctxt: TSQLRestServerURIContext);
begin
  if UrlDecodeNeedParameters(Ctxt.Parameters, 'param1') then
  begin
    DoSomethingShort();

    Ctxt.Returns('something blabla ok');  //return there, the user only need this and don't want to wait
    
    DoSomethingLong(); //Should be executed, but user shouldn't be waiting
  end else
    Ctxt.Error('ERROR: params missing');
end;

and get the result (client side) when it hit "Ctxt.Returns" and not at the end of the procedure, is this possible? I havn't been able to find it in the doc or forum.

Offline

#2 2017-05-31 15:29:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,713
Website

Re: Return in callback

You can use TSQLRest.AsynchRedirect or TSQLRest.TimerEnable for background process.

Offline

Board footer

Powered by FluxBB