does creating headless-client start the onSolutionOpen?

Hi,

when you create a headless client with code like this:

		// Creates a headless client that will open the given solution.
		var headlessClient = plugins.headlessclient.createClient("someSolution", "user", "pass", null);
		if (headlessClient != null && headlessClient.isValid()) {
			var x = new Object();
			x.name = 'remote1';
			x.number = 10;
			headlessClient.queueMethod(null, "remoteMethod", [x], callback);
		}

Does the solution than also fires the onSolutionOpen method?

I’m asking this, because I have one solution, that is working as a batchprocessor (= headlessclient) and I want to use it for offloading work to the server. (= also headless client)
The reason that it is one solution, is that I need 90% of the methods in both situations.

But in case of creating the headless client in code, I don’t want the onSolutionOpen to fire, because there are cronjobs scheduled, that I don’t want.
I can’t also check in the onSolutionOpen if it is batchprocessor or headless-client, because there is only one Constant: APPLICATION_TYPES.HEADLESS_CLIENT

Anyone have an idea?

Maybe You could use different startup parameters.

For instance set Type= batch in servoy admin page for batch processor
and set Type=hlClient when starting it as a headlessclient in the call to start the headless client.

Regards,

headless clients are just clients, they should act as a normal client, so yes onsolutionload should be called.

Why not have an empty solution wrapper around that main solution? So that that solution is just a module
And in a headless client you just load that solutionname_hc solution instead of the solutionname itself?

Thanks Johan, that’s a great idea!

PS. if I do this, the onSolutionOpen of the main-solution (in this case the module) is not fired right?

Harjo:
PS. if I do this, the onSolutionOpen of the main-solution (in this case the module) is not fired right?

correct!