mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
kafka client keep alive间隔时间
This commit is contained in:
@@ -143,9 +143,13 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 间隔一段时间ack一次, 防止因超时未响应切换到另外台客户端
|
// 间隔一段时间ack一次, 防止因超时未响应切换到另外台客户端
|
||||||
|
long currentTS = System.currentTimeMillis();
|
||||||
while (executing.get()) {
|
while (executing.get()) {
|
||||||
|
// 大于1分钟未消费完ack一次keep alive
|
||||||
|
if (System.currentTimeMillis() - currentTS > 60000) {
|
||||||
connector.ack();
|
connector.ack();
|
||||||
Thread.sleep(500);
|
currentTS = System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
connector.ack();
|
connector.ack();
|
||||||
|
|||||||
Reference in New Issue
Block a user