Skip to content

Commit

Permalink
Merge pull request #583 from luankevinferreira/bump-grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Sep 24, 2021
2 parents 1f76160 + 2eb91e9 commit c666b01
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -12,7 +12,7 @@ buildscript {
projectVersion = '2.13.0-SNAPSHOT'

// https://github.com/grpc/grpc-java/releases
grpcVersion = '1.37.0'
grpcVersion = '1.40.1'

// https://github.com/google/guava/releases
guavaVersion = '30.1.1-jre'
Expand Down
2 changes: 1 addition & 1 deletion docs/en/client/configuration.md
Expand Up @@ -75,7 +75,7 @@ There are a number of supported schemes, that you can use to determine the targe
The self address or scheme is a keyword that is available, if you also use `grpc-server-spring-boot-starter` and
allows you to connect to the server without specifying the own address/port. This is especially useful for tests
where you might want to use random server ports to avoid conflicts. \
Example: `self` or `self:self`
Example: `self:self`
- `in-process`: \
This is a special scheme that will bypass the normal channel factory and will use the `InProcessChannelFactory`
instead. Use it to connect to the [`InProcessServer`](../server/configuration.md#enabling-the-inprocessserver). \
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/client/configuration.md
Expand Up @@ -45,7 +45,7 @@ grpc.client.__name__.address=static://localhost:9090
- `static`(优先级 4): 一个简单的IP静态列表 (v4 和 v6), 可用于连接到服务端 (支持 `localhost`)。 例如:`static://192.168.1:8080,10.0.0.1:1337`
- [`dns`](https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L66)(优先级 5):解析并绑定到给定 DNS 名称的所有地址。 地址将被缓存,只有当现有连接被关闭 / 失败时才会刷新。 更多选项,例如 `SVC` 查找(对 kubernetes 有用),可以通过系统属性启用。 例如:`dns:///example.my.company`
- `discovery` (优先级 6):(可选) 使用 Spring Cloud 的`DiscoveryClient` 去查找合适的目标。 在 `HeartbeatEvent` 的时候,连接将自动刷新。 使用 `gRPC_port` 元数据来确定端口,否则使用服务端口。 示例: `discovery:///service-name`
- `self`(优先级 0):如果您使用 `grpc-server-spring-boot-starter` 并且不想指定自己的地址 / 端口,则可以使用 self 关键词作为 scheme 或者 address 。 这对于需要使用随机服务器端口以避免冲突的测试特别有用。 例如:`self``self:self`
- `self`(优先级 0):如果您使用 `grpc-server-spring-boot-starter` 并且不想指定自己的地址 / 端口,则可以使用 self 关键词作为 scheme 或者 address 。 这对于需要使用随机服务器端口以避免冲突的测试特别有用。 例如:`self:self`
- `in-process`:这是一个特殊的方案,将使用 `InProcessChannelFactory` 来替代原有正常的 ChannelFactory。 并使用它连接到 [`InProcessServer`](../server/configuration.md#enabling-the-inprocessserver)。 例如:`in-process:foobar`
- *custom*: 您可以通过 Java 的 `ServiceLoader` 或从 Spring 的应用上下文中选择要自定义的 [`NameResolverProvider`](https://javadoc.io/page/io.grpc/grpc-all/latest/io/grpc/NameResolverProvider.html) ,并将其注册到 `NameResolverRegistry` 上.

Expand Down
Expand Up @@ -50,7 +50,7 @@ public SelfNameResolverFactory(final GrpcServerProperties properties) {

@Override
public NameResolver newNameResolver(final URI targetUri, final Args args) {
if (SELF_SCHEME.equals(targetUri.getScheme()) || targetUri.toString().equals(SELF_SCHEME)) {
if (SELF_SCHEME.equals(targetUri.getScheme())) {
return new SelfNameResolver(this.properties, args);
}
return null;
Expand Down
Expand Up @@ -40,20 +40,17 @@
@SpringBootTest(properties = {
"grpc.server.port=0",
"grpc.client.GLOBAL.negotiationType=PLAINTEXT",
"grpc.client.other.address=self",
"grpc.client.test.address=self:self",
})
@SpringJUnitConfig(classes = {ServiceConfiguration.class, BaseAutoConfiguration.class})
@DirtiesContext
public class SelfNameResolverConnectionTest {

private static final Empty EMPTY = Empty.getDefaultInstance();

@GrpcClient("self")
@GrpcClient("test")
private TestServiceBlockingStub selfStub;

@GrpcClient("other")
private TestServiceBlockingStub otherStub;

/**
* Tests the connection via the implicit client address.
*/
Expand All @@ -62,12 +59,4 @@ public void testSelfConnection() {
assertEquals("1.2.3", this.selfStub.normal(EMPTY).getVersion());
}

/**
* Tests the connection via the explicit client address.
*/
@Test
public void testOtherConnection() {
assertEquals("1.2.3", this.otherStub.normal(EMPTY).getVersion());
}

}

0 comments on commit c666b01

Please sign in to comment.