mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
kafka 客户端 example 完善
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -121,5 +124,4 @@ public class KafkaCanalClientExample {
|
|||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user