Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set kafka connect auto.offset.reset with rest api

I have create a sink kafka connect that convert data to other storage; I want to set auto.offset.reset as latest when new connector is created with kafka connect rest api; I have set consumer.auto.offset.reset: latest in configs;

json { "name": "test_v14", "config": { "name": "test_v14", "consumer.auto.offset.reset": "latest", "connector.class": "...", ... } }

But when task started, kafka consumer still poll records from earliest; So is any other ways to set auto.offset.reset as latest;

like image 239
sweatOtt Avatar asked Dec 17 '25 07:12

sweatOtt


2 Answers

Prior to Kafka 2.3

consumer.auto.offset.reset needs to be set in the connect-distributed.properties file (the Worker).

It cannot be applied to any particular Connector unless that connector class is explicitly creating and loading its own Consumer objects that read in that property.

like image 118
OneCricketeer Avatar answered Dec 19 '25 23:12

OneCricketeer


As of Apache Kafka 2.3, it is now possible to set this as part of a connector's configuration.

On the worker set:

connector.client.config.override.policy=All

Then in the connector you can specify

"consumer.override.auto.offset.reset": "latest"

See this for more details: https://rmoff.net/2019/08/09/starting-a-kafka-connect-sink-connector-at-the-end-of-a-topic/

like image 43
Robin Moffatt Avatar answered Dec 19 '25 22:12

Robin Moffatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!