...
|
...
|
@@ -28,7 +28,6 @@ import org.springframework.context.ApplicationEventPublisherAware; |
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
public abstract class AbstractMqListener implements ApplicationEventPublisherAware, MessageListener {
|
...
|
...
|
@@ -83,9 +82,10 @@ public abstract class AbstractMqListener implements ApplicationEventPublisherAwa |
|
|
}
|
|
|
|
|
|
private String getDataVersionKey(SearchMqMessage searchMqMessage) {
|
|
|
String dbName = searchMqMessage.getDbName();
|
|
|
String tableName = searchMqMessage.getTableName();
|
|
|
String primaryKeysValue = searchMessageHelper.getPrimaryKeysValue(tableName, searchMqMessage.getData());
|
|
|
return new StringBuilder(tableName).append("_").append(primaryKeysValue).toString();
|
|
|
String primaryKeysValue = searchMessageHelper.getPrimaryKeysValue(searchMqMessage.getDbName(), tableName, searchMqMessage.getData());
|
|
|
return new StringBuilder(dbName).append("_").append(tableName).append("_").append("_").append(primaryKeysValue).toString();
|
|
|
}
|
|
|
|
|
|
private boolean checkDataVersion(SearchMqMessage searchMqMessage) {
|
...
|
...
|
@@ -218,19 +218,19 @@ public abstract class AbstractMqListener implements ApplicationEventPublisherAwa |
|
|
}
|
|
|
}
|
|
|
|
|
|
private String getSinglePrimaryKeyValue(SearchMqMessage jsonObject) {
|
|
|
TableConfig tableConfig = tableConfigLoader.getTableConfig(jsonObject.getTableName());
|
|
|
private String getSinglePrimaryKeyValue(SearchMqMessage message) {
|
|
|
TableConfig tableConfig = tableConfigLoader.getTableConfig(message.getDbName(), message.getTableName());
|
|
|
if (tableConfig == null) {
|
|
|
return null;
|
|
|
tableConfig = tableConfigLoader.getTableConfig("", message.getTableName());
|
|
|
}
|
|
|
if (tableConfig.getPrimaryKeys() == null || tableConfig.getPrimaryKeys().length != 1) {
|
|
|
if (tableConfig == null || tableConfig.getPrimaryKeys() == null || tableConfig.getPrimaryKeys().length != 1) {
|
|
|
return null;
|
|
|
}
|
|
|
String tableKey = tableConfig.getPrimaryKeys()[0];
|
|
|
if (StringUtils.isBlank(tableKey)) {
|
|
|
String primaryKey = tableConfig.getPrimaryKeys()[0];
|
|
|
if (StringUtils.isBlank(primaryKey)) {
|
|
|
return null;
|
|
|
}
|
|
|
return MapUtils.getString(jsonObject.getData(), tableKey, null);
|
|
|
return MapUtils.getString(message.getData(), primaryKey, null);
|
|
|
}
|
|
|
|
|
|
protected final long getCost(long begin) {
|
...
|
...
|
|