I’m probably getting quite advanced well before I’m ready but I need to have some business logic running on the application server, irrespective of whether any clients are being used.
From what I’ve read so far, I assume this needs to be done by using the headless client in one form or another.
I tried looking at the sample code; plugins.headlessclient.createClient(solutionName, username, password, solutionOpenMethodArgs);
but this hasn’t revealed a great deal to me.
Anyway, I’ve tried to come up with what I think are some sensible questions as I’m currently a bit lost.
Does the business logic need to be in a separate solution? and should this be created as ‘Module’?
Where in the Server Admin page do you put this instruction? or does this need to be in my main solution (in which case, how do I ensure it only runs once?)
In the above sample, I presume the username and password need to correspond with entries in the ‘User and group security’?
The headless client plugin is not really what you need for this, it can be used to start a headless client to run a method in the background, so your user doesn’t have to wait for the result to continue. When the method is finished you can run a callback method to notify the client.
For the thing you want to, you can better use a batch processor, take a look at the “Batch Processors” page on the admin pages.
A batch processor basically starts whenever the server is started, starts a solution and runs the onOpen method of that solution. In that method you can do business logic or use the scheduler plugin to make certain methods run every day/week/etc.
Thanks for that, I think I was beginning to confuse two entirely different things but I’m on the right path now.
Would it be best to put my business logic into a separate solution?
I guess I could keep it all in a single solution and use arguments passed into the solution to determine whether to only execute the business logic.
Hmmm, swings and roundabouts…