Skip to content

Conversation

@lkokhreidze
Copy link

In certain scenarios users of the KafkaSource in the flink-connector-kafka might want to provide their own KafkaConsumer. Right now this is not possible as consumer is created in the KafkaPartitionSplitReader which makes customisation impossible.

Proposal is to let users pass KafkaConsumerFactory when building the KafkaSource.

public interface KafkaConsumerFactory {
  KafkaConsumer<byte[], byte[]> get(Properties properties);
}

Builder will have a default implementation which creates the KafkaConsumer the same as it is done now.

@boring-cyborg
Copy link

boring-cyborg bot commented Nov 28, 2024

Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)

@lkokhreidze lkokhreidze changed the title FLINK-36817: Introduce KafkaConsumerFactory [FLINK-36817] Introduce KafkaConsumerFactory Nov 28, 2024
@lkokhreidze
Copy link
Author

Will add the javadocs. But first wanted to get the initial feedback if this makes sense.

import java.util.Properties;

public interface KafkaConsumerFactory {
KafkaConsumer<byte[], byte[]> get(Properties properties);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating myself if it would be better to return Consumer interface instead of the implementation. Happy to change it if community agrees that returning an interface is the better choice.

@github-actions
Copy link

This PR is being marked as stale since it has not had any activity in the last 90 days.
If you would like to keep this PR alive, please leave a comment asking for a review.
If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out to the
community, contact details can be found here: https://flink.apache.org/what-is-flink/community/

If this PR is no longer valid or desired, please feel free to close it.
If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions bot added the stale label Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant