fixed issue #1625, mq dymaic topic match

This commit is contained in:
agapple
2019-03-25 17:54:35 +08:00
parent 08167c95c7
commit 661d119265
4 changed files with 10 additions and 11 deletions

View File

@@ -52,6 +52,8 @@ public class CanalStater {
// disable netty // disable netty
System.setProperty(CanalConstants.CANAL_WITHOUT_NETTY, "true"); System.setProperty(CanalConstants.CANAL_WITHOUT_NETTY, "true");
String autoScan = CanalController.getProperty(properties, CanalConstants.CANAL_AUTO_SCAN); String autoScan = CanalController.getProperty(properties, CanalConstants.CANAL_AUTO_SCAN);
// 设置为raw避免ByteString->Entry的二次解析
System.setProperty("canal.instance.memory.rawEntry", "false");
if ("true".equals(autoScan)) { if ("true".equals(autoScan)) {
String rootDir = CanalController.getProperty(properties, CanalConstants.CANAL_CONF_DIR); String rootDir = CanalController.getProperty(properties, CanalConstants.CANAL_CONF_DIR);
if (StringUtils.isEmpty(rootDir)) { if (StringUtils.isEmpty(rootDir)) {

View File

@@ -46,7 +46,7 @@ canal.instance.filter.black.regex=
# mq config # mq config
canal.mq.topic=example canal.mq.topic=example
# dynamic topic route by schema or table regex # dynamic topic route by schema or table regex
#canal.mq.dynamicTopic=.*,mytest,mytest\\..*,mytest2.user #canal.mq.dynamicTopic=mytest1.user,mytest2\\..*,.*\\..*
canal.mq.partition=0 canal.mq.partition=0
# hash partition config # hash partition config
#canal.mq.partitionsNum=4 #canal.mq.partitionsNum=4

View File

@@ -509,7 +509,7 @@ public class MQMessageUtils {
} }
private static Set<String> matchTopics(String name, String dynamicTopicConfigs) { private static Set<String> matchTopics(String name, String dynamicTopicConfigs) {
String[] router = StringUtils.split(dynamicTopicConfigs, ';'); String[] router = StringUtils.split(dynamicTopicConfigs, ',');
Set<String> topics = new HashSet<>(); Set<String> topics = new HashSet<>();
for (String item : router) { for (String item : router) {
int i = item.indexOf(":"); int i = item.indexOf(":");

View File

@@ -53,9 +53,6 @@ public class CanalMQStarter {
System.setProperty("canal.instance.filter.transaction.entry", "true"); System.setProperty("canal.instance.filter.transaction.entry", "true");
} }
// 设置为raw避免ByteString->Entry的二次解析
System.setProperty("canal.instance.memory.rawEntry", "false");
canalServer = CanalServerWithEmbedded.instance(); canalServer = CanalServerWithEmbedded.instance();
// 对应每个instance启动一个worker线程 // 对应每个instance启动一个worker线程