Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-36817] Introduce KafkaConsumerFactory #137

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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.

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.

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