-
Notifications
You must be signed in to change notification settings - Fork 41.2k
add isolation level to KafkaProperties #17389
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
add isolation level to KafkaProperties #17389
Conversation
@garyrussell @artembilan Does making the isolation level configurable seem reasonable to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left my concern as a review, @wilkinsona .
Let's hear what @garyrussell thinks on the matter!
* (non-transactional messages will be unconditionally returned, regardless of | ||
* this setting). | ||
*/ | ||
private String isolationLevel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may make sense if it is mapped as an org.apache.kafka.common.requests.IsolationLevel
enum type.
Otherwise this one indeed can be mapped as all other generic properties in the spring.kafka.consumer.properties
container.
More over I think such a property description is too long. Essentially there is just enough to mention that it is mapped onto ConsumerConfig.ISOLATION_LEVEL_CONFIG)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coincedentally, I had the same two thoughts! On both accounts, I went the direction I did because of the precedent set by existing config options. I found valid values being defined in metadata instead of enums in this example and I added the description in the comment again based on all of the existing config.
Interestingly, the isolation.level
property does have its doc constant exposed as public
even though most other config options are private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, there is no enum for ConsumerConfig.AUTO_OFFSET_RESET_CONFIG
(certainly not used there) which is why it's handled that way.
The isolation level enum is used in ConsumerConfig
so it's best to use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, they have to lower case the enum anyway, so maybe this is the best solution after all.
IsolationLevel.READ_UNCOMMITTED.toString().toLowerCase(Locale.ROOT);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still would be better to be based on enum. That way, when they introduce a new level, we are going to be covered automatically together with content assistant in the IDE.
As discussed here.
So OTOH, it is nice to have content assist in IDEs so I have no objection (subject to Artem's suggestion of using the enum so that you get content-assist on valid values). However, as we discussed when we added the initial support in boot, there are so many kafka properties, we can't make them all first class citizens. |
Thank you, @garyrussell and @artembilan. Having had my memory refreshed about the myriad properties with which Kafka can be configured, I'm tempted to leave the line drawn where it is and decline this one. Let's see what the rest of the team thinks before making a decision. |
To clarify, I'm aware of the ability to set any arbitrary properties through spring.kafka.consumer.* and friends. But as mentioned in the comment above, it's useful to have autocomplete in IDEs to nudge you in the right direction. In an ideal world, the entire set of consumer configs (and others) would be available, but it seems that would only work if there was a process to generate that code/etc. That being said, the current subset seems arbitrary and I'm not sure what the rationale would be for freezing it now vs letting it incrementally grow over time (until, if ever, a process was figured out to codegen based off the official config api). |
We've discussed this today and come to the conclusion that we don't like the current halfway-house situation and would like to support all of Kafka's properties. That's a large piece of work that'll happen post-2.2 (if at all). In the meantime, given that planned direction, we're happy to add a property for the isolation level. |
Thanks very much for making your first contribution to Spring Boot, @sparty02. The changes have been merged into master with a polish commit that makes use of the |
Add the "isolation.level" property as a well defined config.