use of org.apache.kafka.common.message.DeleteGroupsResponseData.DeletableGroupResult in project kafka by apache.
the class DeleteGroupsRequest method getErrorResponse.
@Override
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
Errors error = Errors.forException(e);
DeletableGroupResultCollection groupResults = new DeletableGroupResultCollection();
for (String groupId : data.groupsNames()) {
groupResults.add(new DeletableGroupResult().setGroupId(groupId).setErrorCode(error.code()));
}
return new DeleteGroupsResponse(new DeleteGroupsResponseData().setResults(groupResults).setThrottleTimeMs(throttleTimeMs));
}
use of org.apache.kafka.common.message.DeleteGroupsResponseData.DeletableGroupResult in project kafka by apache.
the class DeleteConsumerGroupsHandler method handleResponse.
@Override
public ApiResult<CoordinatorKey, Void> handleResponse(Node coordinator, Set<CoordinatorKey> groupIds, AbstractResponse abstractResponse) {
final DeleteGroupsResponse response = (DeleteGroupsResponse) abstractResponse;
final Map<CoordinatorKey, Void> completed = new HashMap<>();
final Map<CoordinatorKey, Throwable> failed = new HashMap<>();
final Set<CoordinatorKey> groupsToUnmap = new HashSet<>();
for (DeletableGroupResult deletedGroup : response.data().results()) {
CoordinatorKey groupIdKey = CoordinatorKey.byGroupId(deletedGroup.groupId());
Errors error = Errors.forCode(deletedGroup.errorCode());
if (error != Errors.NONE) {
handleError(groupIdKey, error, failed, groupsToUnmap);
continue;
}
completed.put(groupIdKey, null);
}
return new ApiResult<>(completed, failed, new ArrayList<>(groupsToUnmap));
}
Aggregations