Search code examples
apache-kafkaapache-kafka-connectkafka-producer-api

Kafka Connect with custom Kafka Producer


I'm trying to build a KafkaConnect source connector and was wondering if it is possible to inject/use a custom Kafka Producer in the process. As per the documentation, I couldn't get much. Any ideas would help!


Solution

  • The poll method of a SourceTask is the producer. Return a List<SourceRecord>, and they get serialized into the configured topic via the Converter definitions.

    If you really want an actual instance of a Producer object, then you shouldn't be using the Connect API