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

Migration task in TacoKit

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Minor
    • None
    • None
    • None
    • All
    • Hide

      it works with tacokit 1.0.1 and studio 7.1.1-SNAPSHOT

      Show
      it works with tacokit 1.0.1 and studio 7.1.1-SNAPSHOT
    • Small

    Description

      Tried implementing migration task using example from documentation: (https://talend.github.io/component-runtime/main/0.0.4/component-registering.html, paragraph 1.1. Management of configuration versions)

      Tried following implementation:

      @Version(value = 2, migrationHandler = RecordLoggerProcessor.Migrations.class) // default version is 1, if some configuration changes happen between 2 versions you can add a migrationHandler
      ...
      public class RecordLoggerProcessor implements Serializable {
          ...
          public static class Migrations implements MigrationHandler {
              private final List<VersionConfigurationHandler> handlers;
      
              // VersionConfigurationHandler implementations are decorated with @Service
              public Migrations(final List<VersionConfigurationHandler> migrations) {
                  this.handlers = migrations;
              }
      
              @Override
              public Map<String, String> migrate(int incomingVersion, Map<String, String> incomingData) {
                  Map<String, String> out = incomingData;
      
                  for (VersionConfigurationHandler handler : handlers) {
                      out = handler.migrate(incomingVersion, out);
                  }
                  return out;
              }
          }
      
          public static interface VersionConfigurationHandler {
              Map<String, String> migrate(int incomingVersion, Map<String, String> incomingData);
          }
      
          @AllArgsConstructor
          @Service
          public static class LogStreamVersionConfigurationHandler implements VersionConfigurationHandler {
              private static final int COMPONENT_VERSION = 2; // component version in which the feature was added
              @Override
              public Map<String, String> migrate(int incomingVersion, Map<String, String> incomingData) {
                  ...
                  incomingData.put("upperCase", "true");
                  return incomingData;
              }
          }
      

      But seems like updating value in incomingData has no effect. Please advise.

      Attachments

        Activity

          People

            akhabali Anas Khabali
            ovarnavina Olha Varnavina (Inactive)
            Anas Khabali
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: