Skip to content

Instantly share code, notes, and snippets.

View syahiaoui's full-sized avatar

YAHIAOUI Samir syahiaoui

  • Zenika
  • Paris
View GitHub Profile
@syahiaoui
syahiaoui / AdminClientOffsetReset.java
Created March 13, 2024 09:56
Kafka reset offsets (latest, earliest, forTimestamp, specific offsets)
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.ListOffsetsResult;
import org.apache.kafka.clients.admin.OffsetSpec;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartitionInfo;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.errors.UnknownMemberIdException;