I am trying to do manual offset commit in following way:
val receiver: KafkaReceiver
val sender: KafkaSender
val flux = receiver.receive() // from one message, I am creating Flux of items which are transformed and then send to another topic
.flatMap { Flux.fromIterable() }
.map { transform() }
sender.send(flux) // sending Flux to some other topic
.doOnNext { logging() }
.collectList()
.doOnSuccess {
val item = it.first()
item.receiverOffset.commit().subscribe() // I am storing reactors receiverOffset during transformation
}
.subscribe()
I would like to commit offset once all items are send to that other topic. Unfortunately, doOnSuccess {} logic is never invoked (surprisingly, logging in doOnNext {} works as expected).
Could someone point me what I am doing wrong? I am pretty new to project reactor (and reactive programming).