Skip to content

Commit

Permalink
[update][lib][rdbms] Refactor writer.parameter.connection to use a …
Browse files Browse the repository at this point in the history
…map instead of a list
  • Loading branch information
wgzhao committed Oct 10, 2024
1 parent e26003e commit e681280
Show file tree
Hide file tree
Showing 28 changed files with 1,044 additions and 1,116 deletions.
11 changes: 11 additions & 0 deletions core/src/main/java/com/wgzhao/addax/core/util/ConfigParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ private static void upgradeJobConfig(Configuration configuration)
}
configuration.set(JOB_CONTENT_READER_PARAMETER, reader);
}
// switch `write.connection` from list to map
Configuration writer = configuration.getConfiguration(JOB_CONTENT_WRITER_PARAMETER);
if (writer != null) {
if (writer.getString(CONNECTION, "").startsWith("[")) {
List<Map> connectionList = configuration.getList(JOB_CONTENT_WRITER_PARAMETER + ".connection", Map.class);
if (connectionList != null && !connectionList.isEmpty()) {
writer.set(CONNECTION, connectionList.get(0));
}
}
configuration.set(JOB_CONTENT_WRITER_PARAMETER, writer);
}
}

private static Configuration parseCoreConfig()
Expand Down
Loading

0 comments on commit e681280

Please sign in to comment.