com.clickzetta.platform.client.CZRpcResponseRetryCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.platform.client;
import com.clickzetta.platform.client.api.*;
import com.clickzetta.platform.client.message.RequestMessage;
import com.clickzetta.platform.client.message.ResponseMessage;
import com.google.common.collect.Lists;
import cz.proto.ingestion.Ingestion;
import java.util.List;
import java.util.stream.Collectors;
public class CZRpcResponseRetryCallback extends RpcResponseRetryCallback<
RequestMessage,
ResponseMessage> {
public CZRpcResponseRetryCallback(Session session, Options options) {
super(session, options, options.getRequestFailedRetryStatus().getCodeList()
.stream().map(Ingestion.Code::getNumber).collect(Collectors.toList()));
}
@Override
public Message buildSuccessMessage(RequestMessage request,
ResponseMessage response) {
return new SuccessMessage(session.getSessionId(), request.getOriginal(), response.getOriginal());
}
@Override
public Message buildFailureMessage(Table table, RequestMessage request,
ResponseMessage response) {
return new FailureMessage(session.getSessionId(), session.getStream().getTable(), request.getOriginal(), response.getOriginal());
}
@Override
public Message buildOnErrorMessage(Table table, RequestMessage request) {
return new Message() {
@Override
public String getSessionId() {
return session.getSessionId();
}
@Override
public long getBatchId() {
return request.getRequestId();
}
@Override
public long getTimestamp() {
return request.getTimestamp();
}
@Override
public List getSchemaName() {
return Lists.newArrayList(table.getSchemaName());
}
@Override
public List getTableName() {
return Lists.newArrayList(table.getTableName());
}
@Override
public long getTotalRowsCounts() {
return request.getBatchCount();
}
@Override
public List getRowStates() {
return null;
}
@Override
public int getErrorRowsCounts() {
return 0;
}
@Override
public List getErrorRows() {
return null;
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy