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

fix miss in-process #1102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ List<GrpcChannelConfigurer> defaultChannelConfigurers() {
return Collections.emptyList();
}

// First try the shaded netty channel factory
// First try the shaded netty channel factory and in process factory
@ConditionalOnMissingBean(GrpcChannelFactory.class)
@ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel",
"io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder"})
"io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder", "io.grpc.inprocess.InProcessChannelBuilder"})
@Bean
@Lazy
GrpcChannelFactory shadedNettyGrpcChannelFactory(
GrpcChannelFactory inProcessOrShadedNettyGrpcChannelFactory(
final GrpcChannelsProperties properties,
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry,
final List<GrpcChannelConfigurer> channelConfigurers) {
Expand All @@ -162,12 +162,13 @@ GrpcChannelFactory shadedNettyGrpcChannelFactory(
return new InProcessOrAlternativeChannelFactory(properties, inProcessChannelFactory, channelFactory);
}

// Then try the normal netty channel factory
// Then try the normal netty channel factory and in process factory
@ConditionalOnMissingBean(GrpcChannelFactory.class)
@ConditionalOnClass(name = {"io.netty.channel.Channel", "io.grpc.netty.NettyChannelBuilder"})
@ConditionalOnClass(name = {"io.netty.channel.Channel", "io.grpc.netty.NettyChannelBuilder",
"io.grpc.inprocess.InProcessChannelBuilder"})
@Bean
@Lazy
GrpcChannelFactory nettyGrpcChannelFactory(
GrpcChannelFactory inProcessOrNettyGrpcChannelFactory(
final GrpcChannelsProperties properties,
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry,
final List<GrpcChannelConfigurer> channelConfigurers) {
Expand All @@ -180,8 +181,38 @@ GrpcChannelFactory nettyGrpcChannelFactory(
return new InProcessOrAlternativeChannelFactory(properties, inProcessChannelFactory, channelFactory);
}

// Then try the shaded netty channel factory
@ConditionalOnMissingBean(GrpcChannelFactory.class)
@ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel",
"io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder"})
@Bean
@Lazy
GrpcChannelFactory shadedNettyGrpcChannelFactory(
final GrpcChannelsProperties properties,
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry,
final List<GrpcChannelConfigurer> channelConfigurers) {

log.info("Detected grpc-netty-shaded: Creating ShadedNettyChannelFactory");
return new ShadedNettyChannelFactory(properties, globalClientInterceptorRegistry, channelConfigurers);
}

// Then try the normal netty channel factory
@ConditionalOnMissingBean(GrpcChannelFactory.class)
@ConditionalOnClass(name = {"io.netty.channel.Channel", "io.grpc.netty.NettyChannelBuilder"})
@Bean
@Lazy
GrpcChannelFactory nettyGrpcChannelFactory(
final GrpcChannelsProperties properties,
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry,
final List<GrpcChannelConfigurer> channelConfigurers) {

log.info("Detected grpc-netty: Creating NettyChannelFactory");
return new NettyChannelFactory(properties, globalClientInterceptorRegistry, channelConfigurers);
}

// Finally try the in process channel factory
@ConditionalOnMissingBean(GrpcChannelFactory.class)
@ConditionalOnClass(name = {"io.grpc.inprocess.InProcessChannelBuilder"})
@Bean
@Lazy
GrpcChannelFactory inProcessGrpcChannelFactory(
Expand Down