use of org.apache.kafka.common.message.OffsetDeleteRequestData in project kafka by apache.
the class RequestResponseTest method createOffsetDeleteRequest.
private OffsetDeleteRequest createOffsetDeleteRequest(short version) {
OffsetDeleteRequestTopicCollection topics = new OffsetDeleteRequestTopicCollection();
topics.add(new OffsetDeleteRequestTopic().setName("topic1").setPartitions(singletonList(new OffsetDeleteRequestPartition().setPartitionIndex(0))));
OffsetDeleteRequestData data = new OffsetDeleteRequestData();
data.setGroupId("group1");
data.setTopics(topics);
return new OffsetDeleteRequest.Builder(data).build(version);
}
use of org.apache.kafka.common.message.OffsetDeleteRequestData in project kafka by apache.
the class DeleteConsumerGroupOffsetsHandler method buildRequest.
@Override
public OffsetDeleteRequest.Builder buildRequest(int coordinatorId, Set<CoordinatorKey> groupIds) {
validateKeys(groupIds);
final OffsetDeleteRequestTopicCollection topics = new OffsetDeleteRequestTopicCollection();
partitions.stream().collect(Collectors.groupingBy(TopicPartition::topic)).forEach((topic, topicPartitions) -> topics.add(new OffsetDeleteRequestTopic().setName(topic).setPartitions(topicPartitions.stream().map(tp -> new OffsetDeleteRequestPartition().setPartitionIndex(tp.partition())).collect(Collectors.toList()))));
return new OffsetDeleteRequest.Builder(new OffsetDeleteRequestData().setGroupId(groupId.idValue).setTopics(topics));
}
Aggregations