New Headless Client Plugin - Any Tutorials Available?

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?

Not yet, have a look at the sample code to get started

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:

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()
}

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?

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.

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

client = plugins.headlessclient.createClient('headlessProcess','myname','mypwd','');

I tried it on both server and developer, same result. What am I doing wrong?

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

Paul