does creating headless-client start the onSolutionOpen?

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

does creating headless-client start the onSolutionOpen?

Postby Harjo » Fri Oct 26, 2012 10:38 am

Hi,

when you create a headless client with code like this:

Code: Select all
      // 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?
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: does creating headless-client start the onSolutionOpen?

Postby Hans Nieuwenhuis » Fri Oct 26, 2012 11:08 am

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,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: does creating headless-client start the onSolutionOpen?

Postby jcompagner » Wed Nov 07, 2012 12:53 am

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?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: does creating headless-client start the onSolutionOpen?

Postby Harjo » Wed Nov 07, 2012 7:18 pm

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 Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: does creating headless-client start the onSolutionOpen?

Postby mboegem » Thu Nov 08, 2012 11:05 am

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


correct!
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 2 guests