Search in sources :

Example 1 with OffsetDeleteRequestPartition

use of org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestPartition 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);
}
Also used : OffsetDeleteRequestData(org.apache.kafka.common.message.OffsetDeleteRequestData) OffsetDeleteRequestTopicCollection(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopicCollection) OffsetDeleteRequestPartition(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestPartition) OffsetDeleteRequestTopic(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopic)

Example 2 with OffsetDeleteRequestPartition

use of org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestPartition 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));
}
Also used : OffsetDeleteRequestData(org.apache.kafka.common.message.OffsetDeleteRequestData) OffsetDeleteRequestTopicCollection(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopicCollection) TopicPartition(org.apache.kafka.common.TopicPartition) OffsetDeleteRequestPartition(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestPartition) OffsetDeleteRequestTopic(org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopic)

Aggregations

OffsetDeleteRequestData (org.apache.kafka.common.message.OffsetDeleteRequestData)2 OffsetDeleteRequestPartition (org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestPartition)2 OffsetDeleteRequestTopic (org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopic)2 OffsetDeleteRequestTopicCollection (org.apache.kafka.common.message.OffsetDeleteRequestData.OffsetDeleteRequestTopicCollection)2 TopicPartition (org.apache.kafka.common.TopicPartition)1