com.taosdata.jdbc.tmq.OffsetWaitCallback Maven / Gradle / Ivy
package com.taosdata.jdbc.tmq;
import com.taosdata.jdbc.TSDBError;
import java.util.Map;
import static com.taosdata.jdbc.TSDBConstants.TMQ_SUCCESS;
public class OffsetWaitCallback {
private final Map offsets;
private final JNIConsumer> consumer;
private final OffsetCommitCallback callback;
public OffsetWaitCallback(Map offsets, JNIConsumer> consumer, OffsetCommitCallback callback) {
this.offsets = offsets;
this.consumer = consumer;
this.callback = callback;
}
@SuppressWarnings("unused")
public void commitCallbackHandler(int code) {
if (TMQ_SUCCESS != code) {
Exception exception = TSDBError.createSQLException(code, consumer.getErrMsg(code));
callback.onComplete(offsets, exception);
} else {
callback.onComplete(offsets, null);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy