Merge pull request #892 from rewerma/master

kafka client keep alive间隔时间
This commit is contained in:
agapple
2018-08-28 17:47:31 +08:00
committed by GitHub
3 changed files with 7 additions and 5 deletions

View File

@@ -143,9 +143,13 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker {
});
// 间隔一段时间ack一次, 防止因超时未响应切换到另外台客户端
long currentTS = System.currentTimeMillis();
while (executing.get()) {
connector.ack();
Thread.sleep(500);
// 大于1分钟未消费完ack一次keep alive
if (System.currentTimeMillis() - currentTS > 60000) {
connector.ack();
currentTS = System.currentTimeMillis();
}
}
} else {
connector.ack();

View File

@@ -3,8 +3,6 @@ retries: 0
batchSize: 16384
lingerMs: 1
bufferMemory: 33554432
# canal的批次大小,单位 k,量大建议改为1M
canalBatchSize: 50
filterTransactionEntry: true
canalDestinations:

View File

@@ -19,7 +19,7 @@ public class KafkaProperties {
private int lingerMs = 1;
private long bufferMemory = 33554432L;
private boolean filterTransactionEntry = true;
private int canalBatchSize = 5;
private int canalBatchSize = 50;
private List<CanalDestination> canalDestinations = new ArrayList<CanalDestination>();