with enable.idempotence=true the gaps should not occur. However check for broker failures check for producer throttling. ack=all increase retries if needed max.in.flight.requests.per.connection=1 refer https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html?utm_medium=sem&utm_source=google&utm_campaign=ch.sem_br.nonbrand_tp.prs_tgt.dsa_mt.dsa_rgn.namer_lng.eng_dv.all_con.docs&utm_term=&creative=&device=c&placement=&gad_source=1&gclid=Cj0KCQiA0--6BhCBARIsADYqyL-OSCgnA5c4cYO4J2Y4_FXTJ9lKzNWNwwHNpGGdQVCMw9o5_Ce7FacaAr6pEALw_wcB to configure producers and consumers accordingly