Skip to content

WIP: Split NamedChannel out of autoconfigure #74

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

Closed

Conversation

onobc
Copy link
Contributor

@onobc onobc commented Dec 2, 2024

No description provided.

@onobc onobc marked this pull request as draft December 2, 2024 17:59

import java.time.Duration;

public record NamedChannel(String address,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, there will be more fields here (just a sample)

import org.springframework.core.env.Environment;
import org.springframework.core.env.StandardEnvironment;

public class NamedChannelRegistry implements EnvironmentAware, VirtualTargets {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will handle the virtual targets lookups but its now divorced of config props.

@@ -48,14 +48,22 @@ ClientInterceptorsConfigurer clientInterceptorsConfigurer(ApplicationContext app
return new ClientInterceptorsConfigurer(applicationContext);
}

@Bean
NamedChannelRegistry namedChannelRegistry(GrpcClientProperties properties) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the abstraction used in core now

@@ -39,23 +36,16 @@
import io.grpc.netty.NettyChannelBuilder;

@ConfigurationProperties(prefix = "spring.grpc.client")
public class GrpcClientProperties implements EnvironmentAware {
public class GrpcClientProperties {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note we still keep all the config props named channel variant here which is needed for type-safe config props, auto-completion in IDE, etc.. We just map them to the NamecChannel records in core (registry)

@onobc onobc changed the title WIP WIP: Split NamedChannel out of autoconfigure Dec 2, 2024
@onobc
Copy link
Contributor Author

onobc commented Jan 7, 2025

Closing in favor of #89

@onobc onobc closed this Jan 7, 2025
@onobc onobc deleted the GH-67-wip-move-named-channel-to-core branch January 7, 2025 03:03
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.

1 participant