Uploaded image for project: 'Talend Component Kit'
  1. Talend Component Kit
  2. TCOMP-2297

Support flow return var for tck connector in studio

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

    • All
    • GreenHopper Ranking:
      0|i2i5mb:
    • 9223372036854775807
    • Small
    • To be defined

    Description

      Studio component support the flow output var, like "QUERY" info for tMysqlRow:

      like the screen shot show, then you can use that var in other component.

      And we can define the part in old javajet component xml like this:

      <RETURNS>
          <RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW"/>
      </RETURNS>
      

      AVAILABILITY can be "AFTER" or "FLOW":
      1. "AFTER" mean the var is used after current component done, and value is set once, no change. TCK framework support that before already.
      2. "FLOW" mean the var is changed on row level, for example, in tfixedflowinput==>tmysqlrow==>tjavaflex case, "QUERY" var is set every input row come, tmysqlrow support the sql like this(ok, find another tck limit ) :

      "select * from test where id = '" + row1.id +"'"
      

      then every different input row1 value, different sql for "QUERY", "AFTER" can't work for that.

      After current support, you need to set the TCK connector like this:

      @Slf4j
      @Version(1)
      @ReturnVariable(value = "QUERY", availability = FLOW, type = String.class)
      @Processor(name = "Row")
      @Documentation("JDBC Row component.")
      public class JDBCRowProcessor implements Serializable {
      

      And set value in connector code like this (any place, decide by your AVAILABILITY):

      @RuntimeContext
      private transient RuntimeContextHolder context;
      
      @ElementListener
      public void elementListener(@Input final Record record, @Output final OutputEmitter<Record> success,
                  @Output("reject") final OutputEmitter<Record>/* OutputEmitter<Reject> */ reject) throws SQLException {
         if (context != null) {
             context.set("QUERY", configuration.getDataSet().getSqlQuery());
         }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            wwang Wei Wang
            emmanuel gallois, Fabien Desiles, Wei Wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: