ProductionExceptionHandler in infinite loop for Kafka stream with exactly once enabled

108 views Asked by At

I have an aplication written in kotlin and I use one quiet straightforward Kafka stream inside.

I provided ProductionExceptionHandler and UncaughtExceptionHandler because I do not want the service to crash. Inside both of them I log the exception and then from the first handler I return ProductionExceptionHandlerResponse.CONTINUE and from the second one StreamThreadExceptionResponse.REPLEACE_THREAD.

I have a test where I force the stream to throw RecordTooLargeException, it is thrown correctly and ProductionExceptionHandler is involved in handling that one.

The problem is: Service goes into an infinite loop and tries to send the problematic record over end over again (exactly once). The next message that I am sending to topic is never send/read because service still wants to process the precious wrong one.

Can I somehow skip that message? The transaction is never commited (error is thrown before that) and for exactly once it would not send the next one if not commited. It tries to end the transaction.

0

There are 0 answers