How do I use the headless client?

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

How do I use the headless client?

Postby TonyK » Wed May 18, 2011 11:52 am

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'?

Any help or direction would be most appreciated....

Tony
TonyK
 
Posts: 42
Joined: Mon Sep 27, 2010 6:07 pm

Re: How do I use the headless client?

Postby Joas » Wed May 18, 2011 12:40 pm

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.
Joas de Haan
Joas
Site Admin
 
Posts: 768
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL

Re: How do I use the headless client?

Postby TonyK » Wed May 18, 2011 1:35 pm

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...
TonyK
 
Posts: 42
Joined: Mon Sep 27, 2010 6:07 pm

Re: How do I use the headless client?

Postby itgenetics » Thu May 19, 2011 8:13 am

I guess the headless client would be ideal for running timed methods, batch run reports etc am I right?
itgenetics
 
Posts: 63
Joined: Fri Apr 08, 2011 11:26 am
Location: Cambridge, UK

Re: How do I use the headless client?

Postby pbakker » Thu May 19, 2011 1:34 pm

That sounds more like a batchprocessor job to me

Paul
pbakker
 
Posts: 2817
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 1 guest