Skip to content

Conversation

@thjarvin
Copy link
Contributor

@thjarvin thjarvin commented Jun 6, 2025

Fixes AB#57327

@thjarvin thjarvin requested review from LofhJann and haphut June 11, 2025 09:49
Copy link
Contributor

@LofhJann LofhJann left a comment

Choose a reason for hiding this comment

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

Works.

Requesting some clarifications and changes, some smaller some bigger but main logic is fine.

int timeOutMs = connTimeOutSecs * 1000;
Jedis jedis = new Jedis(redisHost, port, timeOutMs);
jedis.connect();
protected Jedis createRedisClient(@NotNull String redisHost, int port) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer having the opportunity to use both our own Redis or Redis managed by Azure. Please rather create a separate method or class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, sorry, I have to write this somewhere:

Some of the methods in this class do not really use private instance variables of the object, apart from the logger. Would a cleaner approach aim for static methods, perhaps split over several classes? Why is something named PulsarApplication creating Jedis clients with intricate code and health checks?

If possible, I would rather follow "clean as you code" instead of waiting for separate refactoring issues that might not get prioritized high enough, unless we need a total rewrite issue.

.build());
}

public static String extractUsernameFromToken(String token) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method looks nasty (and is from the Azure code samples). I would bury these Azure-specific things in a separate Azure kludge class if we choose to keep both kinds of Jedis clients.

public boolean checkResponse(@Nullable final Long response) {
return response != null && response == 1;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

For all code copied from the Azure code samples, please refer to the exact commit and mention the license under which it is copied in a comment. E.g. The following method is copied or adapted from https://github.com/Azure/azure-sdk-for-java/blob/e7103f9019669032c7ffc3b51f1bd30c6ad8655f/sdk/identity/azure-identity/src/samples/Azure-Cache-For-Redis/Jedis/Azure-AAD-Authentication-With-Jedis.md under the MIT license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants