I’m working on a web app where there could be multiple users who need a recurring process - such as an email sent to them - and the customer’s data files will be in separate folders. The best way that I can see to handle this is to create a console app that is running all the time with a timer that will continually check to see if it is time to send the email. Since the data files are in separate client folders and they could each have different settings for the email, it would have to be a controller app that would periodically check each one and determine if the email should be sent.
Is a console web app that is running all the time the best way to handle this? Our plan is to deploy this app on xojocloud.
As already mentioned, you could just setup Timer in the App.Opening event that will be executed periodically.
As Timers will be executed on the Main Thread, any heavy operation could block processing new browser requests, so move anything that could be blocking them into a Thread. Also, when working with processes that aren’t tied to web sessions, you want to use a Timer instead of a WebTimer and a Thread instead of a WebThread.
Alternatively, if you prefer the helper Console application, the Timer in the sample project would be calling a Shell that executes your helper process, instead of the Thread.
I add the email data into a host database then contact the WebApp with a HandleURL eg https://www.MyCompany.com/SendAllEmails
which sends out all outstanding emails, then updates the database that the email has been sent (or any errors) so they aren’t sent again. No need for a Timer!