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.