mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
根据主键Hash增加正则表达式支持,pk通配符指定自动获取支持
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
package com.alibaba.otter.canal.instance.core;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CanalMQConfig {
|
||||
|
||||
private String topic;
|
||||
private Integer partition;
|
||||
private Integer partitionsNum;
|
||||
private String partitionHash;
|
||||
|
||||
private volatile Map<String, String> partitionHashProperties;
|
||||
private String topic;
|
||||
private Integer partition;
|
||||
private Integer partitionsNum;
|
||||
private String partitionHash;
|
||||
|
||||
public String getTopic() {
|
||||
return topic;
|
||||
@@ -44,25 +39,4 @@ public class CanalMQConfig {
|
||||
this.partitionHash = partitionHash;
|
||||
}
|
||||
|
||||
public Map<String, String> getPartitionHashProperties() {
|
||||
if (partitionHashProperties == null) {
|
||||
synchronized (CanalMQConfig.class) {
|
||||
if (partitionHashProperties == null) {
|
||||
if (partitionHash != null) {
|
||||
partitionHashProperties = new LinkedHashMap<>();
|
||||
String[] items = partitionHash.split(",");
|
||||
for (String item : items) {
|
||||
int i = item.indexOf(":");
|
||||
if (i > -1) {
|
||||
String dbTable = item.substring(0, i).trim();
|
||||
String pk = item.substring(i + 1).trim();
|
||||
partitionHashProperties.put(dbTable, pk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return partitionHashProperties;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user