use of org.apache.kafka.clients.admin.internals.CoordinatorKey in project kafka by apache.
the class DescribeTransactionsResult method description.
/**
* Get the description of a specific transactional ID.
*
* @param transactionalId the transactional ID to describe
* @return a future which completes when the transaction description of a particular
* transactional ID is available.
* @throws IllegalArgumentException if the `transactionalId` was not included in the
* respective call to {@link Admin#describeTransactions(Collection, DescribeTransactionsOptions)}.
*/
public KafkaFuture<TransactionDescription> description(String transactionalId) {
CoordinatorKey key = CoordinatorKey.byTransactionalId(transactionalId);
KafkaFuture<TransactionDescription> future = futures.get(key);
if (future == null) {
throw new IllegalArgumentException("TransactionalId " + "`" + transactionalId + "` was not included in the request");
}
return future;
}
use of org.apache.kafka.clients.admin.internals.CoordinatorKey in project kafka by apache.
the class KafkaAdminClient method deleteConsumerGroups.
@Override
public DeleteConsumerGroupsResult deleteConsumerGroups(Collection<String> groupIds, DeleteConsumerGroupsOptions options) {
SimpleAdminApiFuture<CoordinatorKey, Void> future = DeleteConsumerGroupsHandler.newFuture(groupIds);
DeleteConsumerGroupsHandler handler = new DeleteConsumerGroupsHandler(logContext);
invokeDriver(handler, future, options.timeoutMs);
return new DeleteConsumerGroupsResult(future.all().entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey().idValue, Map.Entry::getValue)));
}
use of org.apache.kafka.clients.admin.internals.CoordinatorKey in project kafka by apache.
the class KafkaAdminClient method removeMembersFromConsumerGroup.
@Override
public RemoveMembersFromConsumerGroupResult removeMembersFromConsumerGroup(String groupId, RemoveMembersFromConsumerGroupOptions options) {
List<MemberIdentity> members;
if (options.removeAll()) {
members = getMembersFromGroup(groupId);
} else {
members = options.members().stream().map(MemberToRemove::toMemberIdentity).collect(Collectors.toList());
}
String reason = options.reason() == null ? LEAVE_GROUP_REASON : LEAVE_GROUP_REASON + ": " + options.reason();
members.forEach(member -> member.setReason(reason));
SimpleAdminApiFuture<CoordinatorKey, Map<MemberIdentity, Errors>> future = RemoveMembersFromConsumerGroupHandler.newFuture(groupId);
RemoveMembersFromConsumerGroupHandler handler = new RemoveMembersFromConsumerGroupHandler(groupId, members, logContext);
invokeDriver(handler, future, options.timeoutMs);
return new RemoveMembersFromConsumerGroupResult(future.get(CoordinatorKey.byGroupId(groupId)), options.members());
}
Aggregations