camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smalisi <>
Subject camel-kafka 2.18.0 KafkaConsumer manual commit
Date Thu, 01 Dec 2016 10:30:37 GMT

i have a camel route consuming from kafka. When an unhandled Exception is
thrown within that route i do not want the kafka offset to be committed.

As a first step i set the autoCommitEnable property to false. This is my

public static final String START_KAFKA_RECEIVER =

                .routeId( ROUTE_START_KAFKA_RECEIVER )
                .log( "Process received Kafka message." )
                .process( new Processor() {
                        public void process( Exchange exchange ) throws
Exception {
                                throw new Exception( "Let the route fail."
                } )

After throwing the exception the offset is committed to Kafka.
-> Line 149: consumer.commitSync[...]

This is done even if an exception is thrown.

Is this the right way it should work?
Is there any possibility to really manually commit the offsets or just don't
commit if an unhandled exception is thrown?

Thanks for your help.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message