I have a long-running process that runs via a CRON in headless on the server.
The user can spawn another instance of the headless running the same solution in the application.
So far, so good.
What I would like to do - is when the headless process is done running - is to send a message (or trigger a global method) on the CLIENT that started the process.
Right now I’m just sending an email when the job is done.
I tried using the UserManager plug-in, but it will only trigger global methods and send a message to the SMART client, not the WEB client.
Is this even possible?
If the WebClient triggered the Headless Client to open and run a method using the HeadlessClient plugin, then you will automatically get a callback in the queueMethod function.
If the processes are running in a CRON (so not triggered through headlessClient plugin) then you’ll have to build something more fancy. So you have a few options…
-
You could implement some client side polling to a RESTful webservice you build that checks if the process is done. You could also do this server side via the schedule plugin. So you somehow check if its done, if so, then run what you need to run.
-
Use servoy’s built-in data broadcasting! So, in your application, I assume you have a user record. Add a column in there for user_alerts. Show the user_alert column for the logged in user somewhere on your app in the header or footer where they could always see it. Make it an HTML_AREA. Then in your server side CRON process, when it finishes a job for a user, write to the user_alerts column for the users record, like Your Job finished. Click Here for more info
So, the user would just visually see the alert. Then clear it out after they click on it to acknowledge the alert.
I’d go with #2.
AH! Good idea! I was sort of going down the road of #2 - but I thought I was just being lame… ![Very Happy :D]()
Thanks very much for the ideas, Scott!!