修改adapter打包,启动方式

This commit is contained in:
mcy
2018-11-06 14:52:17 +08:00
parent 2e1a1c31e6
commit 5b94c69d10
14 changed files with 366 additions and 250 deletions

View File

@@ -99,11 +99,11 @@ public class ESSyncConfigLoader {
InputStream in = null;
try {
// 先取本地文件,再取类路径
File configFile = new File("config/" + config);
File configFile = new File("../config/" + config);
if (configFile.exists()) {
in = new FileInputStream(configFile);
} else {
in = ESSyncConfigLoader.class.getClassLoader().getResourceAsStream(config);
in = ESSyncConfigLoader.class.getClassLoader().getResourceAsStream(config);
}
if (in == null) {
throw new RuntimeException("Config file: " + config + " not found.");

View File

@@ -9,6 +9,7 @@ import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.otter.canal.client.adapter.es.config.ESSyncConfig;
import com.alibaba.otter.canal.client.adapter.es.config.ESSyncConfig.ESMapping;
import com.alibaba.otter.canal.client.adapter.es.config.ESSyncConfigLoader;
@@ -38,9 +39,6 @@ public class ESSyncService {
}
public void sync(Dml dml) {
if (logger.isDebugEnabled()) {
logger.debug("DML: {}", dml.toString());
}
long begin = System.currentTimeMillis();
String database = dml.getDatabase();
String table = dml.getTable();
@@ -74,6 +72,9 @@ public class ESSyncService {
esSyncConfigs.size(),
dml.getDestination());
}
if (logger.isDebugEnabled()) {
logger.debug("DML: {}", JSON.toJSONString(dml));
}
}
}