kafka 客户端 example 完善

This commit is contained in:
rewerma
2018-06-13 14:01:30 +08:00
parent ec072a45d8
commit 9964bb75b1

View File

@@ -86,7 +86,6 @@ public class KafkaCanalClientExample {
} }
private void process() { private void process() {
while (running) {
try { try {
connector.subscribe(); connector.subscribe();
while (running) { while (running) {
@@ -110,7 +109,11 @@ public class KafkaCanalClientExample {
connector.ack(); // 提交确认 connector.ack(); // 提交确认
} catch (WakeupException e) { } catch (WakeupException e) {
try {
Thread.sleep(500); //延时确保running状态的改变
} catch (InterruptedException ie) {
//ignore //ignore
}
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@@ -122,4 +125,3 @@ public class KafkaCanalClientExample {
} }
} }
} }
}