View Full Version : Asynchronous Operations?

2012-04-30, 12:59
One of the needs of many business apps is the ability to set off a lengthy process from the UI that reports back to the UI when done (or failed). There are many different scenarios: can you give a brief overview of what will, and won't, be available in each mode of operation (desktop vs. web/mobile vs. native mobile)?



2012-04-30, 19:47
We will blog this.

2012-05-04, 11:44
And you did blog it, at http://www.lianja.com/resources/blog/39-coding-tips/137-running-background-tasks-in-lianja- (for those reading this thread). And very cool.

Question: will it work on Windows? (I know, I could test, but that will take longer than you typing yes or no ;).)

Question: is it possible to get a values, or values, or object back from the spawned prg directly, or would one have have to use an intermediate store of whatever kind to access once the task completes?

Question: is it possible to pass parameters to the PRG being spawned?

ER: is would be very nice to be able to set up an eventhandler and forget about it after that.



2012-05-04, 19:56
Yes all platforms. (beta8 refresh 4).

Arguments. Not yet will add a --args switch.

Having a built-in class with event callbacks is a good idea will look into that.

2012-05-04, 23:53
Fantastic (as always :)).

--args will be for sending or also for getting back values/objects? The use case I have in mind is the process fails, and returns the error information.

A use case for the callback (and timers have always been a pain, frankly) is heads-down data entry where mucho processing is needed to fill in foreign values which will display in the grid. So the row is marked (color) and disabled, until the callback, when the data (hopefully passed from the process as a record object, but XML would do in a pinch) is passed back. This way, the user can add rows as fast as they can add the basic information (e.g., sku, uom and qty), and when they are done, everything will be there for their review and adjustment.

BTW: is Lianja spawning threads or processes? I.e, is it parallel processing?



2012-05-05, 00:06
Processes. Self contained executable instances that won't bring anything else down if they fail. On x-core CPUs the OS takes care of all the CPU scheduling anyway. Never been a fan of threads.

On linux we support message queues. Windows does not have this (rather nice feature). Message queues allow you to run a "server" that just sits there waiting for work to do do, does it then gives back the results.

We do have the ability to serialize and deserialize objects and dynamic arrays (yes I know fox does not have dynamic arrays; in Lianja they are just like PHP associative arrays and act as a key/value store).

You may have to write some custom code to do what you want until we come up witha good cross platform solution for returning objects etc across process boundaries. Later on will investigate the options.

Now in saying all that Lianja also supports pipes...

It is also worth mentioning that the fopen(), fgets() functions can also take "http://wherever.com/yourwebservice" rather than just a regular filename as well.

2012-05-05, 00:16
OMG: it's like the discussions Frank Camp and I would have (Frank's one of the brightest devs I've met). I'd say "wouldn't it be great" and the next morning, typically, it would be there. Tough things maybe a few days. I'd love to have the two of you in the same room, just to listen. I'd have a silly-ass grin on my face just watching the competition of ideas -- Frank is Dutch, and so doesn't leave any unsupported idea go unchallenged. My role in our discussions is to point out the user reality, users being of course mere mortals like myself.

What got me was the fopen() stuff. Fantastic.