use of org.apache.kafka.common.protocol.Errors in project kafka by apache.
the class FetchSnapshotResponse method errorCounts.
@Override
public Map<Errors, Integer> errorCounts() {
Map<Errors, Integer> errors = new HashMap<>();
Errors topLevelError = Errors.forCode(data.errorCode());
if (topLevelError != Errors.NONE) {
errors.put(topLevelError, 1);
}
for (FetchSnapshotResponseData.TopicSnapshot topicResponse : data.topics()) {
for (FetchSnapshotResponseData.PartitionSnapshot partitionResponse : topicResponse.partitions()) {
errors.compute(Errors.forCode(partitionResponse.errorCode()), (error, count) -> count == null ? 1 : count + 1);
}
}
return errors;
}
use of org.apache.kafka.common.protocol.Errors in project kafka by apache.
the class DescribeTransactionsResponse method errorCounts.
@Override
public Map<Errors, Integer> errorCounts() {
Map<Errors, Integer> errorCounts = new HashMap<>();
for (TransactionState transactionState : data.transactionStates()) {
Errors error = Errors.forCode(transactionState.errorCode());
updateErrorCounts(errorCounts, error);
}
return errorCounts;
}
use of org.apache.kafka.common.protocol.Errors in project kafka by apache.
the class OffsetFetchResponse method errorCounts.
@Override
public Map<Errors, Integer> errorCounts() {
Map<Errors, Integer> counts = new HashMap<>();
if (!groupLevelErrors.isEmpty()) {
// built response with v8 or above
for (Map.Entry<String, Errors> entry : groupLevelErrors.entrySet()) {
updateErrorCounts(counts, entry.getValue());
}
for (OffsetFetchResponseGroup group : data.groups()) {
group.topics().forEach(topic -> topic.partitions().forEach(partition -> updateErrorCounts(counts, Errors.forCode(partition.errorCode()))));
}
} else {
// built response with v0-v7
updateErrorCounts(counts, error);
data.topics().forEach(topic -> topic.partitions().forEach(partition -> updateErrorCounts(counts, Errors.forCode(partition.errorCode()))));
}
return counts;
}
use of org.apache.kafka.common.protocol.Errors in project kafka by apache.
the class DescribeTransactionsRequest method getErrorResponse.
@Override
public DescribeTransactionsResponse getErrorResponse(int throttleTimeMs, Throwable e) {
Errors error = Errors.forException(e);
DescribeTransactionsResponseData response = new DescribeTransactionsResponseData().setThrottleTimeMs(throttleTimeMs);
for (String transactionalId : data.transactionalIds()) {
DescribeTransactionsResponseData.TransactionState transactionState = new DescribeTransactionsResponseData.TransactionState().setTransactionalId(transactionalId).setErrorCode(error.code());
response.transactionStates().add(transactionState);
}
return new DescribeTransactionsResponse(response);
}
use of org.apache.kafka.common.protocol.Errors in project kafka by apache.
the class UpdateFeaturesResponse method errorCounts.
@Override
public Map<Errors, Integer> errorCounts() {
Map<Errors, Integer> errorCounts = new HashMap<>();
updateErrorCounts(errorCounts, Errors.forCode(data.errorCode()));
for (UpdatableFeatureResult result : data.results()) {
updateErrorCounts(errorCounts, Errors.forCode(result.errorCode()));
}
return errorCounts;
}
Aggregations