|
@@ -10,6 +10,8 @@ import com.alibaba.otter.canal.protocol.CanalEntry;
|
|
|
import com.alibaba.otter.canal.protocol.Message;
|
|
|
import com.retdata.canal.handler.AbstractCanalDbHandler;
|
|
|
import com.ruoyi.common.enums.DataSourceEnum;
|
|
|
+import com.ruoyi.common.enums.DataSourceType;
|
|
|
+import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -296,6 +298,7 @@ public class CannalClient {
|
|
|
log.warn("应用正在关闭,跳过处理: {}", tableName);
|
|
|
break;
|
|
|
}
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.CSO.name());
|
|
|
canalDbHandler.processRow(rowData, eventType, dataSourceEnum);
|
|
|
}catch (Exception e){
|
|
|
if (!running) {
|
|
@@ -306,6 +309,8 @@ public class CannalClient {
|
|
|
}
|
|
|
} finally {
|
|
|
log.info("{} 结束处理", tableName);
|
|
|
+
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
}
|
|
|
}
|
|
|
}
|