feat:(1.3.0-beta1): nettyPort废弃改为serverPort
This commit is contained in:
parent
5abd1be3f1
commit
45af9d09b9
@ -55,7 +55,7 @@ public class SnailJobServerLogbackAppender<E> extends UnsynchronizedAppenderBase
|
|||||||
logContentDTO.addLocationField(getLocationField(event));
|
logContentDTO.addLocationField(getLocationField(event));
|
||||||
logContentDTO.addThrowableField(getThrowableField(event));
|
logContentDTO.addThrowableField(getThrowableField(event));
|
||||||
logContentDTO.addHostField(NetUtil.getLocalIpStr());
|
logContentDTO.addHostField(NetUtil.getLocalIpStr());
|
||||||
logContentDTO.addPortField(SnailSpringContext.getBean(SystemProperties.class).getNettyPort());
|
logContentDTO.addPortField(SnailSpringContext.getBean(SystemProperties.class).getServerPort());
|
||||||
|
|
||||||
LogMetaDTO logMetaDTO = null;
|
LogMetaDTO logMetaDTO = null;
|
||||||
try {
|
try {
|
||||||
|
@ -11,6 +11,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,8 +42,23 @@ public class SystemProperties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* netty 端口
|
* netty 端口
|
||||||
|
* see: serverPort
|
||||||
*/
|
*/
|
||||||
private int nettyPort = 1788;
|
@Deprecated
|
||||||
|
private Integer nettyPort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端端口
|
||||||
|
*/
|
||||||
|
private int serverPort = 17888;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务端端口
|
||||||
|
*/
|
||||||
|
public int getServerPort() {
|
||||||
|
// since: 1.3.0-beta1 兼容nettyPort
|
||||||
|
return Objects.isNull(nettyPort) ? serverPort : nettyPort;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server token
|
* server token
|
||||||
|
@ -66,7 +66,7 @@ public class ServerRegister extends AbstractRegister {
|
|||||||
context.setGroupName(GROUP_NAME);
|
context.setGroupName(GROUP_NAME);
|
||||||
context.setHostId(CURRENT_CID);
|
context.setHostId(CURRENT_CID);
|
||||||
context.setHostIp(NetUtil.getLocalIpStr());
|
context.setHostIp(NetUtil.getLocalIpStr());
|
||||||
context.setHostPort(systemProperties.getNettyPort());
|
context.setHostPort(systemProperties.getServerPort());
|
||||||
context.setContextPath(Optional.ofNullable(serverProperties.getServlet().getContextPath()).orElse(StrUtil.EMPTY));
|
context.setContextPath(Optional.ofNullable(serverProperties.getServlet().getContextPath()).orElse(StrUtil.EMPTY));
|
||||||
context.setNamespaceId(NAMESPACE_ID);
|
context.setNamespaceId(NAMESPACE_ID);
|
||||||
context.setExtAttrs(JsonUtil.toJsonString(serverNodeExtAttrs));
|
context.setExtAttrs(JsonUtil.toJsonString(serverNodeExtAttrs));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.aizuda.snailjob.server.common.rpc.client;
|
package com.aizuda.snailjob.server.common.rpc.client;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||||
import com.aizuda.snailjob.common.core.context.SnailSpringContext;
|
import com.aizuda.snailjob.common.core.context.SnailSpringContext;
|
||||||
import com.aizuda.snailjob.common.core.enums.HeadersEnum;
|
import com.aizuda.snailjob.common.core.enums.HeadersEnum;
|
||||||
@ -119,7 +118,7 @@ public class GrpcChannel {
|
|||||||
|
|
||||||
private static String getServerPort() {
|
private static String getServerPort() {
|
||||||
SystemProperties properties = SnailSpringContext.getBean(SystemProperties.class);
|
SystemProperties properties = SnailSpringContext.getBean(SystemProperties.class);
|
||||||
return String.valueOf(properties.getNettyPort());
|
return String.valueOf(properties.getServerPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.aizuda.snailjob.server.common.rpc.client;
|
package com.aizuda.snailjob.server.common.rpc.client;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||||
import com.aizuda.snailjob.common.core.context.SnailSpringContext;
|
import com.aizuda.snailjob.common.core.context.SnailSpringContext;
|
||||||
import com.aizuda.snailjob.common.core.enums.HeadersEnum;
|
import com.aizuda.snailjob.common.core.enums.HeadersEnum;
|
||||||
@ -20,7 +19,6 @@ import java.net.ConnectException;
|
|||||||
import java.nio.channels.ClosedChannelException;
|
import java.nio.channels.ClosedChannelException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -104,7 +102,7 @@ public class NettyChannel {
|
|||||||
|
|
||||||
private static String getServerPort() {
|
private static String getServerPort() {
|
||||||
SystemProperties properties = SnailSpringContext.getBean(SystemProperties.class);
|
SystemProperties properties = SnailSpringContext.getBean(SystemProperties.class);
|
||||||
return String.valueOf(properties.getNettyPort());
|
return String.valueOf(properties.getServerPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +66,7 @@ public class GrpcServer implements Lifecycle {
|
|||||||
|
|
||||||
final MutableHandlerRegistry handlerRegistry = new MutableHandlerRegistry();
|
final MutableHandlerRegistry handlerRegistry = new MutableHandlerRegistry();
|
||||||
addServices(handlerRegistry, new GrpcInterceptor());
|
addServices(handlerRegistry, new GrpcInterceptor());
|
||||||
NettyServerBuilder builder = NettyServerBuilder.forPort(systemProperties.getNettyPort())
|
NettyServerBuilder builder = NettyServerBuilder.forPort(systemProperties.getServerPort())
|
||||||
.executor(createGrpcExecutor(grpc.getDispatcherTp()));
|
.executor(createGrpcExecutor(grpc.getDispatcherTp()));
|
||||||
|
|
||||||
Duration keepAliveTime = grpc.getKeepAliveTime();
|
Duration keepAliveTime = grpc.getKeepAliveTime();
|
||||||
@ -84,7 +84,7 @@ public class GrpcServer implements Lifecycle {
|
|||||||
server.start();
|
server.start();
|
||||||
this.started = true;
|
this.started = true;
|
||||||
SnailJobLog.LOCAL.info("------> snail-job remoting server start success, grpc = {}, port = {}",
|
SnailJobLog.LOCAL.info("------> snail-job remoting server start success, grpc = {}, port = {}",
|
||||||
GrpcServer.class.getName(), systemProperties.getNettyPort());
|
GrpcServer.class.getName(), systemProperties.getServerPort());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
SnailJobLog.LOCAL.error("--------> snail-job remoting server error.", e);
|
SnailJobLog.LOCAL.error("--------> snail-job remoting server error.", e);
|
||||||
started = false;
|
started = false;
|
||||||
|
@ -65,10 +65,10 @@ public class NettyHttpServer implements Runnable, Lifecycle {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 在特定端口绑定并启动服务器 默认是17888
|
// 在特定端口绑定并启动服务器 默认是17888
|
||||||
ChannelFuture future = bootstrap.bind(systemProperties.getNettyPort()).sync();
|
ChannelFuture future = bootstrap.bind(systemProperties.getServerPort()).sync();
|
||||||
|
|
||||||
SnailJobLog.LOCAL.info("------> snail-job remoting server start success, nettype = {}, port = {}",
|
SnailJobLog.LOCAL.info("------> snail-job remoting server start success, nettype = {}, port = {}",
|
||||||
NettyHttpServer.class.getName(), systemProperties.getNettyPort());
|
NettyHttpServer.class.getName(), systemProperties.getServerPort());
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
future.channel().closeFuture().sync();
|
future.channel().closeFuture().sync();
|
||||||
|
@ -79,7 +79,7 @@ logging:
|
|||||||
snail-job:
|
snail-job:
|
||||||
retry-pull-page-size: 1000 # 拉取重试数据的每批次的大小
|
retry-pull-page-size: 1000 # 拉取重试数据的每批次的大小
|
||||||
job-pull-page-size: 1000 # 拉取重试数据的每批次的大小
|
job-pull-page-size: 1000 # 拉取重试数据的每批次的大小
|
||||||
netty-port: 17888 # 服务端netty端口
|
server-port: 17888 # 服务端netty端口
|
||||||
limiter: 1000 # 一个客户端每秒最多接收的重试数量指令
|
limiter: 1000 # 一个客户端每秒最多接收的重试数量指令
|
||||||
step: 100 # 号段模式下步长配置
|
step: 100 # 号段模式下步长配置
|
||||||
log-storage: 45 # 日志保存时间(单位: day)
|
log-storage: 45 # 日志保存时间(单位: day)
|
||||||
|
Loading…
Reference in New Issue
Block a user