-
Notifications
You must be signed in to change notification settings - Fork 11
ServerConfiguration
恒宇少年 edited this page Sep 5, 2020
·
7 revisions
ServerConfiguration 类提供了定制配置消息处理服务端(Server)的一些相关参数。
我们在项目中使用也很简单,只需要将实例化后的配置对象注册到IOC容器内即可,当然注册的方式有很多种,下面我们以@Bean注解为例:
/**
* 实例化服务端配置
*
* @return The {@link ServerConfiguration} instance
*/
@Bean
public ServerConfiguration serverConfiguration() {
return new ServerConfiguration()
.setExpiredExcludeThresholdSeconds(10)
.setCheckClientExpiredIntervalSeconds(5);
}配置服务端(Server)的端口号,该端口号主要是用于客户端(Client)配置注册时使用。
注意事项:该配置参数并不是项目启动时的HTTP端口号,而是内部grpc服务端的端口号。
- Server
- Client