New Headless Client Plugin - Any Tutorials Available?

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

New Headless Client Plugin - Any Tutorials Available?

Postby Kahuna » Wed Jan 20, 2010 6:45 pm

Hi Folks - I've got a couple of really long process which I need to run regularly but don't want the client hung during that time.

The headless client plugin looks like it may be what we need to run these in a new thread?

Area there any tutorials on how this new plugin works to get us (simpletons) started?
(Servoy Version: 6.0.7 Win XP / 7 - SQL Server 2008 R2)
Ian Cordingley (Kahuna)
Kahuna
 
Posts: 1235
Joined: Thu Oct 26, 2006 1:39 am
Location: 1/2 NE UK 1/2 Olvera Spain

Re: New Headless Client Plugin - Any Tutorials Available?

Postby pbakker » Thu Jan 21, 2010 10:23 am

Not yet, have a look at the sample code to get started
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: New Headless Client Plugin - Any Tutorials Available?

Postby jcompagner » Thu Jan 21, 2010 12:50 pm

do remember that you start a new client on the server, so it wont have the same state as you now have in your client (it is not just a new thread in your current client)

a quick demo code:

Code: Select all
var client = null;
/**
* @properties={typeid:24,uuid:"BAD1AEE9-9B72-477A-A0AA-10619F4C2127"}
*/
function headlessTest()
{
   client = plugins.headlessclient.createClient(solutionName,username,password,solutionOpenMethodArgs)
   client.queueMethod(null,globalmethodnameinremotesolution,args,callbackFunction)
}

/**
* @param {JSEvent} event
*/
function callbackFunction(event)
{
   // do some stuff
   if (JSClient.CALLBACK_EVENT == event.getType())
   {
      // handle normal execute of remote method
   }
   else if (JSClient.CALLBACK_EXCEPTION_EVENT == event.getType())
   {
      // handle exception execute of remote method
   }
   client.shutdown()
}
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: New Headless Client Plugin - Any Tutorials Available?

Postby Kahuna » Thu Jan 21, 2010 1:00 pm

Thanks Johan - that makes sense.

I was thinking I could use it as a new thread - but running the process on the server is way more powerful.

Forgive my ignorance - but using this plugin means a headless client is started on the server - but unlike running a HLC from a scheduler, there must be a solution open at the time to initiate it?
(Servoy Version: 6.0.7 Win XP / 7 - SQL Server 2008 R2)
Ian Cordingley (Kahuna)
Kahuna
 
Posts: 1235
Joined: Thu Oct 26, 2006 1:39 am
Location: 1/2 NE UK 1/2 Olvera Spain

Re: New Headless Client Plugin - Any Tutorials Available?

Postby jcompagner » Thu Jan 21, 2010 1:35 pm

you start a headless client on the server with this call:

plugins.headlessclient.createClient(solutionName,username,password,solutionOpenMethodArgs)

and that will load the solution you specify there.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: New Headless Client Plugin - Any Tutorials Available?

Postby Jeroen de Vries » Thu Jun 10, 2010 3:40 pm

When I try to use the headless client plugin in Servoy 5.1.2, I get Can't find method com.servoy.extensions.plugins.headlessclient.HeadlessClientProvider.js_createClient(string,string,string,string)
on
Code: Select all
client = plugins.headlessclient.createClient('headlessProcess','myname','mypwd','');


I tried it on both server and developer, same result. What am I doing wrong?
Jeroen de Vries
Softwear BV
www.softwear.nl
Jeroen de Vries
 
Posts: 61
Joined: Sun Mar 02, 2008 12:18 pm

Re: New Headless Client Plugin - Any Tutorials Available?

Postby pbakker » Thu Jun 10, 2010 3:51 pm

The last argument has to be an array, not a string.

Paul
pbakker
 
Posts: 2822
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 2 guests

cron