Skip to main content
February 12, 2008
Answered

getActiveInstances

  • February 12, 2008
  • 1 reply
  • 282 views
Hello,

I'm trying to create an application system based on FMIS, and my basic model involves having multiple instances of one application running, and managing those instances with another application. I believe that I can implement my management with appropriately configured .asc files and NetConnection objects, but I want the application instances to be dynamically named, and to retrieve these instances in real time from the server. Based on my reading of the Administration API Reference, it seems that the getActiveInstances function should fulfill this need. However, I'm having trouble getting it to work. I've tried to implement it this way:

var objResult = new Object();
objResult.onResult = function() {
/*trace("Result :" + this.toString());
for (var obj in this) {
trace(obj + " = " + this[obj]);
}*/
trace("Results :" + this.data);
}
objResult.onStatus = function() {
/*trace("Status :" + this.toString());
for (var obj in this) {
trace(obj + " = " + this[obj]);
}*/
trace("Status :" + this.data);
}
nc.call("getActiveInstances", objResult);

In the above, nc is a NetConnection object that is successfully connecting to my admin server. The commented out code in my onResult and onStatus handlers worked, but showed no array of string names of application instances. The data property of the objResult object is coming back undefined.

I'd like to find an example of how to successfully implement this concept. I'm not married to the use of getActiveInstances, although I would like to be able to dynamically query the server and retrieve the currently running applications on FMIS. Thanks in advance for any assistance.
    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer
    Hey,

    Nevermind! I figured out that I needed to modify my event handlers to include a parameter to represent the information object returned by the method call, and that this object then contains the data I'm seeking in the data property. So for example, the onResult handler is now:

    objResult.onResult = function(infoObj) {
    trace("Results :" + infoObj.data);
    }

    Thanks in advance for reading, hopefully my confusion will be useful to others!

    1 reply

    Correct answer
    February 12, 2008
    Hey,

    Nevermind! I figured out that I needed to modify my event handlers to include a parameter to represent the information object returned by the method call, and that this object then contains the data I'm seeking in the data property. So for example, the onResult handler is now:

    objResult.onResult = function(infoObj) {
    trace("Results :" + infoObj.data);
    }

    Thanks in advance for reading, hopefully my confusion will be useful to others!