fixed rocketmq ack npe

This commit is contained in:
agapple
2018-11-20 17:14:29 +08:00
parent 43db5bec97
commit b6f1e0d13c
@@ -214,9 +214,13 @@ public class RocketMQCanalConnector implements CanalMQConnector {
@Override
public void ack() throws CanalClientException {
try {
this.lastGetBatchMessage.ack();
if (this.lastGetBatchMessage != null) {
this.lastGetBatchMessage.ack();
}
} catch (Throwable e) {
this.lastGetBatchMessage.fail();
if (this.lastGetBatchMessage != null) {
this.lastGetBatchMessage.fail();
}
} finally {
this.lastGetBatchMessage = null;
}
@@ -225,7 +229,9 @@ public class RocketMQCanalConnector implements CanalMQConnector {
@Override
public void rollback() throws CanalClientException {
try {
this.lastGetBatchMessage.fail();
if (this.lastGetBatchMessage != null) {
this.lastGetBatchMessage.fail();
}
} finally {
this.lastGetBatchMessage = null;
}