Client callbacks from XData services?

I send a request to my XData service and it spawns off a bunch of separate tasks. I'd like a way to notify the client that each task has completed and to update a grid with status displayed and result data. It doesn't have to be tight real-time, but not every minute either. A few seconds of slack is fine.

Is there any way of doing this with what's there now?

If not, I was thinking of using MQTT to ping the client to poll the service for status updates (as opposed to just having it poll itself). Actually, if the data is small enough, MQTT might be able to send the results back directly.

Or what about a blocking service call that just returns when there's something to report, then it gets reposted?

Not exactly what you're after, but this was posted recently about firing off multiple async requests and waiting for them to finish...

So if your service request that launches separate threads could instead be separate services, then maybe this could accomplish the same thing with the ability to show them individually completing?

My service forwards requests to a 3rd-party service and gets back a HUGE chunk of data. It then picks off the fields we need and sends them back to the client. If they're not sent back immediately, they need to be saved temporarily.

The app has two lists, A and B; the service will send (A.count * B.count) number of requests to the 3rd-party service.

Honestly, I've been going back and forth with whether to: (1) just send ONE request to the service with both lists and have the service combine each piece and send out a bunch to the 3rd-party service, or (2) have the app do the combining and submit a BATCH of separate requests to the service to have it forward on and process.

I guess that option (2) would solve the problem, eh?

However, I'm using Delphi, not WebCore, so there's no await option. However, it looks like RESTRequest.ExecuteAsync could be called inside of a loop for each of the paired parameters where it will process the results each task gets back via an anonymous function passed as one of the parameters.

That also eliminates the need for temporarily saving the results on the service ... which probably makes approach (2) far more preferable anyway. I had not noticed that before.

So thanks for the suggestion!

Ah, glad it helped, even if indirectly. I'm a bit new to XData (and WebCore) but as a long-time Delphi developer, it has been endlessly entertaining to rethink how to design apps to be more a combination of services rather than just a collection of components. Having absolutely everything multithreaded and async is a very different environment to work in.

I'm trying to get my footing with XData as well. It's looking a lot like building a DLL when doing local debugging, with the added benefit that you can move it to run on another server by just changing a line or two of code.

But trying to figure out how to manage exceptions thrown by hidden child tasks from other local services is getting maddening...

There is no current "server-to-client notification" system in XData. MQTT might be an option. We have started working on web sockets support and that will make it possible, but it's under work for now.