PDA

View Full Version : Lianja.spawnApp and parameter



HankFay
2017-03-08, 14:27
Lianja.spawnApp conveniently allows running a .dbo (compiled prg) directly, as so:

lcDbo = "myprg.dbo"
lcPathedDbo = set("dire") + lcDbo
Lianja.spawnApp(lcPathedDbo)

Here's the challenge: I'm launching this from a web service (.rsp page application/json), and need to have the .dbo accept a parameter so that it processes a particular instance based on data pointed to by the parameter.

Although SessionStorage might look like an answer, that has the same issue: I would need to communicate the "key" for the .dbo to access.

Any suggestions?

thanks,

Hank

PS: oops, just discovered that the .dbo isn't being run. Filing a bug. If it's being run, I might have a solution using spawnid() on the calling side and getid() on the running side to morph into the sessionstorage key.

barrymavin
2017-03-08, 18:33
Hi Hank

You cannot use Lianja.spawnApp() from a server page. The Lianja system object is only available in the clients I.e desktop, web or mobile.

Lianja.spawnApp() is desktop specific as it relies on being called from the lianja runtime client.

HankFay
2017-03-09, 09:11
Hi Barry,

OK, testing a wrapper for SPAWN so I don't have to think every time I use it. There's (almost) always a different way.

thanks,

Hank

barrymavin
2017-03-09, 09:27
Hi Hank

Rather than spawning a process from inside a web service I'd recommend you implement a consumer/producer architecture which will be much more scaleable.

See my post in these forums on resource locks.

You could add request records to a table in the web service always locking a known resource exclusively beforehand.

You then have a background job (using cron on linux or task scheduler on Windows) running that reads records from the table and processes the requests. When there are no more requests, lock a known resource and zap the table then unlock the resource.