Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is a Connector Loop?

146 views
Skip to first unread message

Eddie Hartman

unread,
Sep 28, 2010, 4:04:46 AM9/28/10
to
I get this question regularly and thought I'd drop my dissertation
here.

The Feed section of an AL is a loop that cycles a Connector in
Iterator mode once for each entry read, passing these to Flow section
components for processing. A Connector Loop works in a similar
fashion, driving an input Connector and sending each entry to
subordinate components. However, there are important differences:

First off, the built-in Feed/Flow loop of the AssemblyLine offers End-
of-Flow functionality. For example, when you use a Change Detection
Connector then you can decide when Iterator state is to be persisted,
and one option is at the end of each AL cycle. The same is true for
when JDBC/Database Connectors or the Delta Engine commit writes. To
end a cycle prematurely you use the system.exitFlow() or
system.skipEntry() function calls - although the latter method only
works when you have an Iterator in the Feed section.

A Connector Loop on the other hand offers no End-of-Loop
functionality, so any persistence of state or db commits must be done
manually. Furthermore, to exit a loop cycle you use
system.exitBranch(): either system.exitBranch("Loop") to leave the
innermost (closest) Loop, or by passing the case-sensitive name of the
Loop (or Branch) to exit.

That said, a Connector Loop offers a number of advantages over Feeds/
Flow. First off, you can easily add pre-cycle logic to your
AssemblyLine by simply adding components prior to the Connector Loop.
Secondly, a Connector Loop supports both Iterator and Lookup modes.
This gives you a simpler way to handle lookups where you expect to
find zero or multiple entries. Instead of having to code the On No
Match and On Multiple Found Hooks, the Connector Loop will cycle once
for each entry found: zero, one or many times. The "special condition"
Hooks mentioned above are still invoked, but are not mandatory in the
context of the Loop.

Another handy feature is the Loop's 'Connector Parameters' map. This
option lets you use standard mapping techniques to set the Connection
parameters of the Connector attached to the Loop. So for example, you
could have an outer Loop (or even Feed Iterator) that reads in a list
of files, while an inner Loop opens and parses each file. This is done
by mapping the path of the file to the 'filePath' parameter. By
default, a Connector Loop is set to 'Initialize and Select/Lookup'
each time cycling begins, which is just what you need when you plan to
change configuration parameters for the Connector whenever the Loop is
activated. Of course, if you are reading from a system like LDAP, JDBC/
DB or Notes and are not mapping new parameter values each time, you
will want to change this option to 'Select/Lookup only'.

Finally, the Connector Loop is a great way to parse Attribute values
that contain collections of entries - for example, XML or CSV encoded
strings. To do this you attach the Form Entry Connector to the Loop
and map the desired Attribute value to the Connector Parameter named
'entryRawData'. The FormEntry Connector is similar to the FileSystem
Connector, except that instead of reading and parsing a file, it
parses the contents of the Raw Entry Data parameter. So by choosing
the relevant Parser and mapping the Attribute to the right parameter,
you are able to cycle through entries encoded in the value. Easy as
spittin' :)

And that's all I have to say about that.
At least for now…

-Eddie

0 new messages