|
|
The AssemblyLineThe general philosophy of an AssemblyLine, is that it will process data (aka entries, records, items, objects) from one data source, transform and aggregate it with data from others sources and finally output it to one or several targets. It is important to keep in mind that the AssemblyLine is designed and optimized for working with one item at a time. However, if you would like to do multiple updates or multiple deletes (i.e. processing more than a single item at the time) then you will have to write AssemblyLine scripts to do handle this; same thing if you want to sort data. This kind of processing can be implemented using your choice of scripts, Java libraries and standard Integrator functionality (like pooling the data to a sorted datastore (e.g. ODBC Connector) and then reading it back and processing it with a second AssemblyLine) The AssemblyLine consists of a number of Connectors that operate in specific modes: It is the AssemblyLine that does the work (it is in a way your 'program'). For an overview of the AssemblyLine please read the Getting Started guide. In very short the AssemblyLine will consist of
The AssemblyLine is usually started by some external event or by the user from the MI Admin tool. The AssemblyLine is defined by a configuration file: This file defines a server that is independent of the Admin Tool (Graphical User Interface) to run. What happens when an AssemblyLine is started?The AssemblyLine flow starts with the execution of code placed in the "Before Connectors Activated" subtab of the Prolog tab. This could be a good place to create a file one of the Connectors expects (typically the result of a preprocessed input file). You could also place code here which change connector specific parameters, such as filenames. Then Connectors are initialized. Each Connector’s initialize function is called in this step. If the Connector operates in Iterator mode, then the Connector’s selectEntries function is also called.Then, when all Connectors are ready for action, the AssemblyLine’s Prolog's "After Connectors Activated" code is executed. The Connectors are then called in the sequence in which they appear in the configuration. Think of this as having each of your data entries flowing down the AssemblyLine.
How can the flow of the AssemblyLine be controlled?Hooks can be used to add extra code and logic within a Connector. If you want to skip or re-execute parts of the AssemblyLine entirely, you will typically do this from within a Hook in a Connector:
Note that if you put any of these command in an Error Hook, the AssemblyLine will continue regardless of how you got to the Error Hook. This means that even syntax errors in your script will be ignored. Check the error object if you want to know what caused the error. Also note that the methods above are implemented as exceptions: This means that no code following these calls will ever be called. Starting from the admin toolWhen you start an AssemblyLine from the admin tool you must have at least one Connector operating in Iterator mode. If you don't have an iterator the AssemblyLine has no data feeding it. You can have multiple Connectors as iterators: The AssemblyLine will start with the first iterator and continue with the next after draining each iterator in the AssemblyLine. Starting from an EventHandler or scriptWhen an AssemblyLine is started (through startAL) by an EventHandler or from a script, the AssemblyLine may be passed parameters feeding it, e.g. an initial working entry (work). Passing an initial working entry causes the AssemblyLine to run through the list of Connectors once before terminating. You can investigate the result (which is the working entry when the AssemblyLine terminates) by using the getResult() function. See also (runtime provided) Connector Example: var entry = system.newEntry(); entry.setAttribute ("cn", "My Name"); // Here we start the AssemblyLine itself var al = main.startAL ( "assemblyline", entry ); // wait for al to finish al.join(); var result = al.getResult(); // assume al sets the mail attribute in its working entry task.logmsg ("Returned email = " + result.getString("mail")); Accessing Connectors inside the AssemblyLineYou may have noticed that you can dynamically load Connectors in your scripts using the system.getConnector function. The Connector object you get from that is what we call the raw Connector object. Inside the assembly however, each Connector is embedded in a wrapper that provides additional functionality to the Connector. Each Connector is available in the AssemblyLine scripts as the name you chose for the Connector when it was added to the AssemblyLine. For example, the Sample1 AssemblyLine in the default configuration has two Connectors named input and output.
|
|
|