-
Notifications
You must be signed in to change notification settings - Fork 69
Virtual targets and duplicate entries in channels map #72
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
Virtual targets and duplicate entries in channels map #72
Conversation
|
Looks like we need a rebase? Also maybe |
35384fe to
16ca26b
Compare
I'm not quite sure, but I don't think so. We can't use from core, for example Also an interesting point. Right now the build is crashing for obvious reasons. If we look carefully in the log, we can see that: This is due to the fact that from core I guess we should think about how to play this properly to handle time correctly? |
...src/main/java/org/springframework/grpc/autoconfigure/client/GrpcClientAutoConfiguration.java
Outdated
Show resolved
Hide resolved
I'm going to pull down and take a look closer. Ulitmately we will want the auto-configuration to map from client properties to the created named channels. The current named channel was doing both setting of defaults as well as representing channels. More likely I would expect a NamedChannel record that is constructed from the NamedChannel properties. |
spring-grpc-core/src/main/java/org/springframework/grpc/client/DefaultGrpcChannelFactory.java
Outdated
Show resolved
Hide resolved
|
I guess we should still move the NamedChannel migration to another PR then, and put the test writing and fixing into this one (or should we?). By the way, I don't know the project very well and I would like you to help me a bit. Am I right that this code can help us and be a test? |
I think that is a good approach.
I think so.
I will take a look at the above code sometime in the next few hours. |
|
Hi @panic08 , The particular "duplicate entries" can be seen when there is a named channel configured w/ an address as follows: Then a call to Let's look at the call chain to understand what's going on... On line 4 above, you can see The main issue is that You can add the following test to @Test
void withCustomChannelReturnsDuplicateEntryMap() {
Map<String, String> map = new HashMap<>();
map.put("spring.grpc.client.channels.custom.address", "static://my-server:8888");
GrpcClientProperties properties = bindProperties(map);
NamedChannelVirtualTargets virtualTargets = new NamedChannelVirtualTargets(properties);
var address = virtualTargets.getTarget("custom");
assertThat(address).isEqualTo("my-server:8888");
assertThat(properties.getTarget("custom")).isEqualTo("my-server:8888");
assertThat(properties.getChannels()).containsOnlyKeys("default", "custom");
}I know it is a lot of details but just let me know if you need more clarification etc.. |
16ca26b to
93f2f4e
Compare
|
Thank you very much for your clarification In and also added the test in Also would like to understand. Am I correct in understanding that you made a slight mistake and instead of |
|
Hmm. As I understand it, we can use |
No it is intentional, as the if (address.startsWith("static:") || address.startsWith("tcp:")) {
address = address.substring(address.indexOf(":") + 1).replaceFirst("/*", "");
} |
93f2f4e to
2372fa1
Compare
2372fa1 to
48bd8bb
Compare
|
I apologize for the inactivity of two weeks. To solve this problem, I thought about it and decided to resort to overloading the I also decided that it would make sense to change which you recommended to I did it because of the acbe334 |
onobc
left a comment
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.
Thanks for the contribution @panic08 - nice work.
Refers to #67