mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
增加kafka自定义properties
This commit is contained in:
@@ -51,6 +51,7 @@ public class CanalConstants {
|
||||
public static final String CANAL_MQ_TRANSACTION = ROOT + "." + "mq.transaction";
|
||||
public static final String CANAL_ALIYUN_ACCESSKEY = ROOT + "." + "aliyun.accessKey";
|
||||
public static final String CANAL_ALIYUN_SECRETKEY = ROOT + "." + "aliyun.secretKey";
|
||||
public static final String CANAL_MQ_PROPERTIES = ROOT + "." + "mq.properties";
|
||||
|
||||
public static String getInstanceModeKey(String destination) {
|
||||
return MessageFormat.format(INSTANCE_MODE_TEMPLATE, destination);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.alibaba.otter.canal.deployer;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -162,7 +163,16 @@ public class CanalStater {
|
||||
if (!StringUtils.isEmpty(transaction)) {
|
||||
mqProperties.setTransaction(Boolean.valueOf(transaction));
|
||||
}
|
||||
|
||||
for (Object key : properties.keySet()) {
|
||||
key = StringUtils.trim(key.toString());
|
||||
if (((String) key).startsWith(CanalConstants.CANAL_MQ_PROPERTIES)) {
|
||||
String value = CanalController.getProperty(properties, (String) key);
|
||||
String subKey = ((String) key).substring(CanalConstants.CANAL_MQ_PROPERTIES.length() + 1);
|
||||
mqProperties.getProperties().put(subKey, value);
|
||||
}
|
||||
}
|
||||
|
||||
return mqProperties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -116,4 +116,5 @@ canal.mq.flatMessage = true
|
||||
canal.mq.compressionType = none
|
||||
canal.mq.acks = all
|
||||
# use transaction for kafka flatMessage batch produce
|
||||
canal.mq.transaction = false
|
||||
canal.mq.transaction = false
|
||||
#canal.mq.properties. =
|
||||
Reference in New Issue
Block a user