The AssemblyLine Function Component (AL FC) wraps the calling of another AssemblyLine into a Component, with some controls on how the other AssemblyLine is executed and what to do with a possible result.
The AssemblyLine FC uses the Server API to call and manage the ALs. The component establishes a server connection to the Server API through RMI and creates a session with the server.
This field will stay empty if the remote AssemblyLine does not have defined initialization parameters in its configuration, that is, the $initialization schema.
This FC provides a handler object for calling and managing AssemblyLines on either the local or a remote Server.
We configure this FC by choosing the AssemblyLine to call, the Server on which this AssemblyLine is defined and should run on (blank or "local" indicating that the AssemblyLine runs on this Server which is running the FC), as well as the Config Instance that the AssemblyLine belongs to. Again, a blank parameter value means that this AssemblyLine is in the same Config Instance as the one containing the FC itself.
You also choose the Execution Mode (see "AL Cycle Mode" in IBM TDI V7.1 Users Guide for more information). Although there are three Execution Modes (Run and wait for completion, Run in background and Manual cycle mode), the first two options are the standard methods of starting an AssemblyLine from script with or without calling the AssemblyLine join() method.
These first two modes cause the target AssemblyLine to run on its own (stand alone) in its own thread. The third mode, cycle mode, means that the target AssemblyLine is controlled by the FC which will execute it one cycle at a time for each time the FC is invoked. When the FC runs an AssemblyLine in stand-alone mode, the FC keeps a reference to the target AssemblyLine - just like you get when you call main.startAL(). The FC can also return the status of the running/terminated ALs. You obtain this status by calling the FC's perform() method with a null or empty Entry parameter. The returned Entry object contains the reference to the target AssemblyLine in an attribute called "value". If you pass a null value to the FC, the return value is the actual reference to the target AssemblyLine (again, like making a main.startAL() call).
We can also call the FC with specific string command values to obtain info about the target AL:
perform("target") | returns the object reference of the target AssemblyLine. |
perform("active") | returns either "active", "aborted" or "terminated" depending on the target AssemblyLine status. |
perform("error") | returns the java.lang.Exception object when the status is "aborted". |
perform("result") | returns the current result Entry object. |
perform("stop") | tries to terminate an active target AL, and will throw an error if the call does not succeed. |
Note that if we have specified the "Run and wait for completion" Execution Mode, then each call to perform() starts the target AssemblyLine and returns the complete status for the execution (for example, reference to the target as well as status and error object). In this case, the initialize() method does NOT start the target AssemblyLine as it does in all other cases. When the FC is called in this mode with an Entry object, the Entry object can contain one or more of the above keywords in an attribute called command (as described in the list above, and concatenated in a comma-separated list). The returned Entry object is then populated with the same values as described above. So, rather than calling perform() several times with each desired command, we can create an Entry with all keywords as attributes in the Entry object and get away with one call to perform():
var e = system.newEntry(); e.setAttribute("command", "target, status"); // In this example, fc references a Function Interface. // If this was an AssemblyLine Function instead, then fc.callreply(e) // would be done. var res = fc.perform(e); task.logmsg("The status is: " + res.getString("status"));
When the FC runs an AssemblyLine in manual mode, each call with an Entry object causes one cycle to be executed in the target AssemblyLine. The returned Entry object is the work entry result at the end of the cycle. When the target AssemblyLine has completed, a null entry is returned. If the cycle execution causes an error, then that error is re-thrown by the FC (so we should use a try-catch block in your script).
The target AssemblyLine can be supplied with parameters, in two different ways.
The Query ("Quick Discovery") button in the FC Input and Output Map tabs will try the following methods for determining the schema of the AssemblyLine to be called:
In the target AssemblyLine we can define an operation called "querySchema"; if this is the case the Input and Output attributes of this operation are used to supply the AssemblyLine FC (or the AssemblyLine Connector) with the schema.
AssemblyLine Connector,
Appendix D. Creating new components using Adapters.