mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
mq模式下adapter配置增加groupId属性对应
This commit is contained in:
@@ -69,10 +69,11 @@ public class HbaseAdapter implements OuterAdapter {
|
||||
for (Map.Entry<String, MappingConfig> entry : hbaseMapping.entrySet()) {
|
||||
String configName = entry.getKey();
|
||||
MappingConfig mappingConfig = entry.getValue();
|
||||
String k = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "."
|
||||
+ mappingConfig.getHbaseMapping().getDatabase() + "."
|
||||
String k = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "-"
|
||||
+ StringUtils.trimToEmpty(mappingConfig.getGroupId()) + "_"
|
||||
+ mappingConfig.getHbaseMapping().getDatabase() + "-"
|
||||
+ mappingConfig.getHbaseMapping().getTable();
|
||||
Map<String, MappingConfig> configMap = mappingConfigCache.computeIfAbsent(k, k1 -> new HashMap<>());
|
||||
Map<String, MappingConfig> configMap = mappingConfigCache.computeIfAbsent(k, k1 -> new ConcurrentHashMap<>());
|
||||
configMap.put(configName, mappingConfig);
|
||||
}
|
||||
|
||||
@@ -104,9 +105,11 @@ public class HbaseAdapter implements OuterAdapter {
|
||||
return;
|
||||
}
|
||||
String destination = StringUtils.trimToEmpty(dml.getDestination());
|
||||
String groupId = StringUtils.trimToEmpty(dml.getGroupId());
|
||||
String database = dml.getDatabase();
|
||||
String table = dml.getTable();
|
||||
Map<String, MappingConfig> configMap = mappingConfigCache.get(destination + "." + database + "." + table);
|
||||
Map<String, MappingConfig> configMap = mappingConfigCache
|
||||
.get(destination + "-" + groupId + "_" + database + "-" + table);
|
||||
if (configMap != null) {
|
||||
List<MappingConfig> configs = new ArrayList<>();
|
||||
configMap.values().forEach(config -> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
dataSourceKey: defaultDS
|
||||
destination: example
|
||||
groupId: g1
|
||||
hbaseMapping:
|
||||
mode: STRING #NATIVE #PHOENIX
|
||||
database: mytest # 数据库名
|
||||
@@ -57,4 +58,4 @@ hbaseMapping:
|
||||
# $UNSIGNED_TIMESTAMP 对应PHOENIX里的UNSIGNED_TIMESTAMP 12字节
|
||||
# $VARCHAR 对应PHOENIX里的VARCHAR 动态长度
|
||||
# $VARBINARY 对应PHOENIX里的VARBINARY 动态长度
|
||||
# $DECIMAL 对应PHOENIX里的DECIMAL 动态长度
|
||||
# $DECIMAL 对应PHOENIX里的DECIMAL 动态长度
|
||||
|
||||
Reference in New Issue
Block a user