package Ġno . nav . person br uk er . dit tn av . br uk er not ifik as jon best iller Ċ Ċ import Ġkotlinx . atomic fu . locks . Re entrant Lock Ċ import Ġkotlinx . atomic fu . locks . with Lock Ċ import Ġno . nav . person br uk er . dit tn av . br uk er not ifik as jon best iller . common . Event Batch Processor Service Ċ import Ġno . nav . person br uk er . dit tn av . br uk er not ifik as jon best iller . common . kafka . Record KeyValue Wrapper Ċ import Ġorg . apache . kafka . clients . consumer . Consumer Records Ċ Ċ class ĠCapt uring Event Processor < K , ĠV > Ġ: ĠEvent Batch Processor Service < K , ĠV > Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlock Ġ= ĠRe entrant Lock () ĊĠĠĠ Ġprivate Ġval Ġevent Buffer Ġ= ĠArrayList < Record KeyValue Wrapper < K , ĠV >>() ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġprocess Events ( events : ĠConsumer Records < K , ĠV >) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġevent List Ġ= Ġevents . as Wrapper List () ĊĊĠĠĠĠĠĠĠ Ġlock . with Lock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevent Buffer . addAll ( event List ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Events () Ġ= Ġlock . with Lock Ġ{ ĊĠĠĠĠĠĠĠ Ġevent Buffer . map Ġ{ Ġit Ġ} ĊĠĠĠ Ġ} Ċ }