use of org.apache.kafka.common.requests.FindCoordinatorResponse in project kafka by apache.
the class CoordinatorStrategy method handleResponse.
@Override
public LookupResult<CoordinatorKey> handleResponse(Set<CoordinatorKey> keys, AbstractResponse abstractResponse) {
Map<CoordinatorKey, Integer> mappedKeys = new HashMap<>();
Map<CoordinatorKey, Throwable> failedKeys = new HashMap<>();
for (CoordinatorKey key : unrepresentableKeys) {
failedKeys.put(key, new InvalidGroupIdException("The given group id '" + key.idValue + "' cannot be represented in a request."));
}
for (Coordinator coordinator : ((FindCoordinatorResponse) abstractResponse).coordinators()) {
CoordinatorKey key;
if (// old version without batching
coordinator.key() == null)
key = requireSingletonAndType(keys);
else {
key = (type == CoordinatorType.GROUP) ? CoordinatorKey.byGroupId(coordinator.key()) : CoordinatorKey.byTransactionalId(coordinator.key());
}
handleError(Errors.forCode(coordinator.errorCode()), key, coordinator.nodeId(), mappedKeys, failedKeys);
}
return new LookupResult<>(failedKeys, mappedKeys);
}
Aggregations