@@ -11,28 +11,36 @@ import javax.net.ssl.SSLContext
11
11
import akka .{ Done , NotUsed }
12
12
import akka .annotation .InternalApi
13
13
import akka .event .LoggingAdapter
14
- import akka .grpc .{ GrpcClientSettings , GrpcResponseMetadata , GrpcSingleResponse }
15
- import akka .stream .scaladsl .{ Flow , Keep , Source }
16
- import io .grpc .{ CallOptions , MethodDescriptor }
14
+ import akka .grpc .GrpcClientSettings
15
+ import akka .grpc .GrpcResponseMetadata
16
+ import akka .grpc .GrpcSingleResponse
17
+ import akka .stream .scaladsl .Flow
18
+ import akka .stream .scaladsl .Keep
19
+ import akka .stream .scaladsl .Source
20
+ import akka .Done
21
+ import akka .NotUsed
17
22
import io .grpc .netty .shaded .io .grpc .netty .GrpcSslContexts
18
23
import io .grpc .netty .shaded .io .grpc .netty .NegotiationType
19
24
import io .grpc .netty .shaded .io .grpc .netty .NettyChannelBuilder
20
- import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolConfig .{
21
- Protocol ,
22
- SelectedListenerFailureBehavior ,
23
- SelectorFailureBehavior
24
- }
25
- import io .grpc .netty .shaded .io .netty .handler .ssl .{
26
- ApplicationProtocolConfig ,
27
- ApplicationProtocolNames ,
28
- SslContext ,
29
- SslContextBuilder
30
- }
25
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolConfig .Protocol
26
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolConfig .SelectedListenerFailureBehavior
27
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolConfig .SelectorFailureBehavior
28
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolConfig
29
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ApplicationProtocolNames
30
+ import io .grpc .netty .shaded .io .netty .handler .ssl .SslContext
31
+ import io .grpc .netty .shaded .io .netty .handler .ssl .SslContextBuilder
32
+ import io .grpc .CallOptions
33
+ import io .grpc .MethodDescriptor
31
34
35
+ import java .util .concurrent .TimeUnit
36
+ import javax .net .ssl .SSLContext
32
37
import scala .annotation .nowarn
33
38
import scala .concurrent .duration .FiniteDuration
34
- import scala .concurrent .{ ExecutionContext , Future , Promise }
35
- import scala .util .{ Failure , Success }
39
+ import scala .concurrent .ExecutionContext
40
+ import scala .concurrent .Future
41
+ import scala .concurrent .Promise
42
+ import scala .util .Failure
43
+ import scala .util .Success
36
44
37
45
/**
38
46
* INTERNAL API
@@ -51,15 +59,17 @@ object NettyClientUtils {
51
59
@ nowarn(" msg=deprecated" )
52
60
var builder =
53
61
NettyChannelBuilder
54
- // Not sure why netty wants to be able to shoe-horn the target into a URI... but ok,
55
- // we follow their lead and encode the service name as the 'authority' of the URI.
56
- .forTarget(" //" + settings.serviceName)
62
+ // Used to be the way to pass the service name to the name resolver but
63
+ // Since grpc-core 1.60.0 Netty does no longer seem to pass the authority along, so we do that
64
+ // ourselves below (channel builder is not shared between different clients anyway).
65
+ .forTarget(s " // ${settings.serviceName}" )
57
66
.flowControlWindow(NettyChannelBuilder .DEFAULT_FLOW_CONTROL_WINDOW )
58
67
// TODO avoid nameResolverFactory #1092, then 'nowarn' can be removed above
59
68
.nameResolverFactory(
60
69
new AkkaDiscoveryNameResolverProvider (
61
70
settings.serviceDiscovery,
62
71
settings.defaultPort,
72
+ settings.serviceName,
63
73
settings.servicePortName,
64
74
settings.serviceProtocol,
65
75
settings.resolveTimeout,
@@ -181,7 +191,9 @@ object NettyClientUtils {
181
191
*/
182
192
@ InternalApi
183
193
private def createNettySslContext (javaSslContext : SSLContext ): SslContext = {
184
- import io .grpc .netty .shaded .io .netty .handler .ssl .{ ClientAuth , IdentityCipherSuiteFilter , JdkSslContext }
194
+ import io .grpc .netty .shaded .io .netty .handler .ssl .ClientAuth
195
+ import io .grpc .netty .shaded .io .netty .handler .ssl .IdentityCipherSuiteFilter
196
+ import io .grpc .netty .shaded .io .netty .handler .ssl .JdkSslContext
185
197
// See
186
198
// https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java#L229-L309
187
199
val apn = new ApplicationProtocolConfig (
0 commit comments