Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Friday, May 4, 2012

Outgoing Connections in Talend Open Studio Custom Components

When building a custom component for Talend Open Studio, start by defining the outgoing connections in the descriptor XML file packaged with the component.  Then, retrieve a handle to one or more outgoing connection objects which will provide you with a variable name to use in your JET code.
Talend Open Studio custom components contain an XML descriptor that includes a list of the allowed outgoing connections.  An outgoing connection that is flow-based like the common "Main" connection can be accessed through a list of outgoing connections for that particular component instance.  For example, an outgoing connection may be tagged with "row2" which can be used in JET code to manipulate the row2Struct data structure.

XML Descriptor

This block of XML code is from the Talend Exchange component tScriptRules.


Two outgoing connections -- FILTER and REJECT -- have been defined as outgoing flow connections.  There can only be one FILTER and one REJECT connect as specified in the MAX_OUTPUT attribute.

JET is a templating language that works like Java Server Pages.  Java code is generated by combining embedded Java sections with an overall format.  The following are blocks of JET code that will make a variable referencing the FILTER outoing connection available.

Accessing the Connections

First, acquire the set of outgoing connections in a main.javajet.  Even though only one is permitted in the XML descriptor, the data structure is still a list.

List< ? extends IConnection > filter_conns = node.getOutgoingConnections("FILTER");


Getting Info from Connection

Next, set a variable aside for later use.   The null check is important so that you don't try to access something that isn't there (there was no FILTER connection set by the user).

   String filterRowName = null;
   if( filter_conns!=null && filter_conns.size()>0) {
      IConnection filter_c = filter_conns.get(0);
      filterRowName = filter_c.getName();


Using Connection Info to Manipulate Objects

This block of code does something with the filterRowName.  It uses the variable as the first part of a data structure ("Struct") and maps the input to the output.

// reassign output to empty struct based on auto-gen
<%= filterRowName %>Struct r_ok = new <%= filterRowName %>Struct();

// take an input column, map to its equivalent output column

   for( IMetadataColumn col : metadata.getListColumns() ) {
      r_ok.<%= col %> = <%= rowName %>.<%= col %>;

A null check prior to this code should be performed as well.

The possible connections available to a Talend Open Studio custom component is set in the XML descriptor.  The actual connections are made by the user in their Talend Open Studio development.  A list of outgoing connections can be used to get a handle to a data structure (ex, "row2Struct") that can be manipulated in the custom component code for the desired functionality.


  1. I am creating a custom component which has plugin dependency on abstractmap specified in _java.xml

    After installing the component I get the error component plugin not found : null
    User Component Folder and Component Project Folder is Talend_Installation_Folder\plugins\org.talend.designer.components.localprovider_version\components
    Please make me understand what am I missing here and how to resolve it.

    1. Are you directly copying your component to the localprovider folder? I use a separate /components folder that I point to in the User Component folder in the settings. I then go into Component Perspective and push my changes to the canvas.