mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-04-23 02:48:34 +08:00
feat: EasyRetry-v3.2.0 => SnailJob-v1.0.0-beta1
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<module>ruoyi-sentinel-dashboard</module>
|
||||
<module>ruoyi-seata-server</module>
|
||||
<module>ruoyi-nacos</module>
|
||||
<module>ruoyi-easyretry-server</module>
|
||||
<module>ruoyi-snailjob-server</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-visual</artifactId>
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.aizuda.easy.retry.server.starter.server;
|
||||
|
||||
import com.aizuda.easy.retry.common.log.EasyRetryLog;
|
||||
import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
||||
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.common.Lifecycle;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||
import io.netty.handler.codec.http.HttpServerCodec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* netty server
|
||||
*
|
||||
* @author: www.byteblogs.com
|
||||
* @date : 2022-03-07 15:54
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class NettyHttpServer implements Runnable, Lifecycle {
|
||||
|
||||
@Autowired
|
||||
private SystemProperties systemProperties;
|
||||
private Thread thread = null;
|
||||
private volatile boolean started = false;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
try {
|
||||
// start server
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
bootstrap.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
.option(ChannelOption.SO_BACKLOG, 128)
|
||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||
.childHandler(new ChannelInitializer<SocketChannel>() {
|
||||
@Override
|
||||
public void initChannel(SocketChannel channel) throws Exception {
|
||||
channel.pipeline()
|
||||
.addLast(new HttpServerCodec())
|
||||
.addLast(new HttpObjectAggregator(5 * 1024 * 1024))
|
||||
.addLast(new NettyHttpServerHandler());
|
||||
}
|
||||
});
|
||||
|
||||
// 在特定端口绑定并启动服务器 默认是1788
|
||||
ChannelFuture future = bootstrap.bind(systemProperties.getNettyPort()).sync();
|
||||
|
||||
EasyRetryLog.LOCAL.info("------> easy-retry remoting server start success, nettype = {}, port = {}",
|
||||
NettyHttpServer.class.getName(), systemProperties.getNettyPort());
|
||||
|
||||
started = true;
|
||||
future.channel().closeFuture().sync();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
EasyRetryLog.LOCAL.info("--------> easy-retry remoting server stop.");
|
||||
} catch (Exception e) {
|
||||
EasyRetryLog.LOCAL.error("--------> easy-retry remoting server error.", e);
|
||||
started = false;
|
||||
throw new EasyRetryServerException("easy-retry server start error");
|
||||
} finally {
|
||||
// 当服务器正常关闭时,关闭EventLoopGroups以释放资源。
|
||||
workerGroup.shutdownGracefully();
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (isStarted()) {
|
||||
return;
|
||||
}
|
||||
thread = new Thread(this);
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (thread != null && thread.isAlive()) {
|
||||
thread.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return started;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.dromara.easyretry;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* EasyRetry Server 启动程序
|
||||
*
|
||||
* @author dhb52
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class EasyRetryServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(com.aizuda.easy.retry.server.EasyRetryServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
Application Version: ${revision}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
_
|
||||
| |
|
||||
___ __ _ ___ _ _ ______ _ __ ___| |_ _ __ _ _ ______ ___ ___ _ ____ _____ _ __
|
||||
/ _ \/ _` / __| | | |______| '__/ _ \ __| '__| | | |______/ __|/ _ \ '__\ \ / / _ \ '__|
|
||||
| __/ (_| \__ \ |_| | | | | __/ |_| | | |_| | \__ \ __/ | \ V / __/ |
|
||||
\___|\__,_|___/\__, | |_| \___|\__|_| \__, | |___/\___|_| \_/ \___|_|
|
||||
__/ | __/ |
|
||||
|___/ |___/
|
||||
@@ -3,16 +3,16 @@ FROM openjdk:17.0.2-oraclelinux8
|
||||
|
||||
MAINTAINER Lion Li
|
||||
|
||||
RUN mkdir -p /ruoyi/easyretry/logs
|
||||
RUN mkdir -p /ruoyi/snailjob/logs
|
||||
|
||||
WORKDIR /ruoyi/easyretry
|
||||
WORKDIR /ruoyi/snailjob
|
||||
|
||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="-Xms512m -Xmx1024m"
|
||||
|
||||
EXPOSE 8800
|
||||
EXPOSE 1788
|
||||
|
||||
ADD ./target/ruoyi-easyretry-server.jar ./app.jar
|
||||
ADD ./target/ruoyi-snailjob-server.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
@@ -9,13 +9,13 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-easyretry-server</artifactId>
|
||||
<artifactId>ruoyi-snailjob-server</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.aizuda</groupId>
|
||||
<artifactId>easy-retry-server-starter</artifactId>
|
||||
<version>${easyretry.version}</version>
|
||||
<artifactId>snail-job-server-starter</artifactId>
|
||||
<version>${snailjob.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dromara.snailjob;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* SnailJob Server 启动程序
|
||||
*
|
||||
* @author opensnail
|
||||
* @date 2024-05-17
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class SnailJobServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(com.aizuda.snailjob.server.SnailJobServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
server:
|
||||
port: 8800
|
||||
servlet:
|
||||
context-path: /easy-retry
|
||||
context-path: /snail-job
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ruoyi-easyretry-server
|
||||
name: ruoyi-snailjob-server
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
web:
|
||||
@@ -13,10 +13,9 @@ spring:
|
||||
static-locations: classpath:admin/
|
||||
|
||||
mybatis-plus:
|
||||
typeAliasesPackage: com.aizuda.easy.retry.template.datasource.persistence.po
|
||||
typeAliasesPackage: com.aizuda.snailjob.template.datasource.persistence.po
|
||||
global-config:
|
||||
db-config:
|
||||
table-prefix: er_
|
||||
where-strategy: NOT_EMPTY
|
||||
capital-mode: false
|
||||
logic-delete-value: 1
|
||||
@@ -0,0 +1,10 @@
|
||||
Application Version: ${revision}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
_ _ _ _
|
||||
(_) (_) | |
|
||||
___ _ __ __ _ _| |_ ___ | |__ ______ ___ ___ _ ____ _____ _ __
|
||||
/ __| '_ \ / _` | | | |/ _ \| '_ \______/ __|/ _ \ '__\ \ / / _ \ '__|
|
||||
\__ \ | | | (_| | | | | (_) | |_) | \__ \ __/ | \ V / __/ |
|
||||
|___/_| |_|\__,_|_|_| |\___/|_.__/ |___/\___|_| \_/ \___|_|
|
||||
_/ |
|
||||
|__/
|
||||
@@ -22,14 +22,14 @@
|
||||
<!-- 开启 skywalking 日志收集 -->
|
||||
<include resource="logback-skylog.xml" />
|
||||
|
||||
<!-- EasyRetry appender -->
|
||||
<appender name="easy_log_server_appender" class="com.aizuda.easy.retry.server.common.appender.EasyRetryServerLogbackAppender">
|
||||
<!-- SnailJob appender -->
|
||||
<appender name="snail_log_server_appender" class="com.aizuda.snailjob.server.common.appender.SnailJobServerLogbackAppender">
|
||||
</appender>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="easy_log_server_appender" />
|
||||
<appender-ref ref="snail_log_server_appender" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user