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

Add spring.redis.lettuce.read-from property for configuring LettuceClientConfiguration's read from setting #42576

Closed
thiagoteichmann opened this issue Oct 9, 2024 · 10 comments
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@thiagoteichmann
Copy link

Currently using Lettuce but noticed that config properties lacks readFrom property and require code change to implement it, would be possible to externalize this in a property so we can override the default?

I currently have a redis sentinel totally configured by properties but I cannot configure read from property the same way.

Something like:

spring.redis.lettuce.config.read-from=REPLICA_PREFERRED

or

spring.redis.config.read-from=REPLICA_PREFERRED

Originally opened a ticket against spring data redis but was requested to open a ticket here.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 9, 2024
@wilkinsona wilkinsona changed the title [Lettuce] Externalize ReadFrom configuration into property Add spring.redis.lettuce.read-from property for configuring LettuceClientConfiguration's read from setting Oct 9, 2024
@wilkinsona wilkinsona added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 9, 2024
@wilkinsona wilkinsona added this to the 3.x milestone Oct 9, 2024
@thiagoteichmann
Copy link
Author

Hi @nosan @wilkinsona , is there any update on this?

@nosan
Copy link
Contributor

nosan commented Oct 15, 2024

Hi @thiagoteichmann,

The issue is still in progress. Before moving forward, @wilkinsona reached out to the Lettuce team to request support for more complex ReadFrom types, such as regex and subnet.

I've created a PR: redis/lettuce#3016. Once it's merged, I believe it would be possible to support this in Spring Boot as well.

@nosan
Copy link
Contributor

nosan commented Oct 15, 2024

However, please keep in mind that I'm just a contributor, so it would be best to wait for @wilkinsona's feedback.

@thiagoteichmann
Copy link
Author

Sure, no worries, thanks for the update! 👍🏻

@tishun
Copy link

tishun commented Oct 16, 2024

@thiagoteichmann are you using snake_case because it is a requirement, or could you also work with kebab-case, e.g.

spring.redis.lettuce.config.read-from=replica-preferred

It would help us consider how we should implement the solution in the end greatly if we know more about your use case.

@wilkinsona
Copy link
Member

wilkinsona commented Oct 16, 2024

@tishun Boot's relaxed binding can take various different property formats so, personally, I wouldn't worry about handling multiple formats in Lettuce. I'd just pick one and stick with it and leave Boot to deal with that complexity.

@nosan
Copy link
Contributor

nosan commented Oct 16, 2024

@wilkinsona
I thought that relaxed bindings only applied to property names, not values. Have I misunderstood or missed something here?

@wilkinsona
Copy link
Member

Boot can bind enums and similar in a relaxed form as well (see LenientObjectToEnumConverterFactory for example). Although we won't be targetting an enum, I think we should do something here and leave Boot to bear the burden of relaxed binding rather than Lettuce having to deal with it too.

@thiagoteichmann
Copy link
Author

thiagoteichmann commented Oct 16, 2024

@thiagoteichmann are you using snake_case because it is a requirement, or could you also work with kebab-case, e.g.

spring.redis.lettuce.config.read-from=replica-preferred

It would help us consider how we should implement the solution in the end greatly if we know more about your use case.

I think kebab would be clearer for me. in my case I might have reads coming from replicas instead of the default master and your sample would be an exact scenario. My original example was just copied from the enum value. :)

@wilkinsona
Copy link
Member

Closing in favor of #42588.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
@wilkinsona wilkinsona removed this from the 3.x milestone Oct 21, 2024
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants
@wilkinsona @tishun @nosan @thiagoteichmann @spring-projects-issues and others