No Description

huanghuijie 6cd14a0121 青涩知夏->修改README 4 years ago
src 3f366914af 青涩知夏->删除无用内容,修改README.md 4 years ago
.gitignore 299afe9bd6 青涩知夏->完善配置 4 years ago
README.md 6cd14a0121 青涩知夏->修改README 4 years ago
nosum-gateway.sh d60e3bbbd9 青涩知夏->修改启动脚本以及README 4 years ago
pom.xml fc7162f1aa 青涩知夏->完善配置 4 years ago

README.md

项目打包

mvn clean package -Dmaven.test.skip=true

打包后会有俩个*.jar,使用nosum-gateway-v1-jar-with-dependencies.jar

运行项目

windows环境下进入到 target中,使用如下命令

java -jar nosum-gateway-v1-jar-with-dependencies.jar

linux环境下,将nosum-gateway-v1-jar-with-dependencies.jarnosum-gateway.sh上传到同一目录中,进入到文件所在目录,执行如下命令

nosum-gateway.sh在项目根目录之中,如果无法执行,可以使用 chmod进行授权

# 启动
sh nosum-gateway.sh start
# 停止
sh nosum-gateway.sh stop
# 查看服务信息
sh nosum-gateway.sh status
# 查看日志信息
sh nosum-gateway.sh logs

下载地址

github地址https

https://github.com/HhjWxx/nosum-gateway.git

github地址ssh

git@github.com:HhjWxx/nosum-gateway.git

个人远程仓库https

https://git.nosum.cn/nosum/nosum-gateway.git

个人远程仓库ssh

root@git.nosum.cn:nosum/nosum-gateway.git

关于扩展

参与dubbo中的SPI

所有具备@SPI注解的接口,可以在resources/META-INF/gateway中新建以接口名为文件名的文件进行扩展

内置扩展

cn.nosum.common.extension.ExtensionFactory

扩展点工厂类,默认使用adaptive

adaptive=cn.nosum.common.extension.factory.AdaptiveExtensionFactory
spi=cn.nosum.common.extension.factory.SpiExtensionFactory

cn.nosum.gateway.container.GateWayContainer

网关容器,默认使用netty

netty=cn.nosum.gateway.container.NettyGateWayContainer

cn.nosum.gateway.handler.build.HandlerBuilder

容器handler构建器,默认使用context

context=cn.nosum.gateway.handler.build.ContextHandlerBuilder

cn.nosum.gateway.slot.build.SlotChainBuilder

处理槽构建器,默认使用context

context=cn.nosum.gateway.slot.build.LinkSlotChainBuilder

cn.nosum.gateway.slot.ProcessorSlotChain

处理槽链路类型,默认使用link

link=cn.nosum.gateway.slot.LinkProcessorSlotChain

application.properties

项目核心配置文件

# 容器端口号
container.port = 8888
request.file.save.folder.name = /usr/local/gateway/request/file
# 示例配置,即使不配置也是默认使用这些
cn.nosum.common.extension.ExtensionFactory = adaptive
cn.nosum.gateway.container.GateWayContainer = netty
cn.nosum.gateway.handler.build.HandlerBuilder = context
cn.nosum.gateway.slot.build.SlotChainBuilder = context
cn.nosum.gateway.slot.LinkProcessorSlotChain = link

GateWay启动入口

public class NoSumGateWayStart {
    public static void main(String[] args) {
        GateWayContainer container = ExtensionLoader
                    .getExtensionLoader(GateWayContainer.class)
                    .getAdaptiveExtension();
        container.start();
    }
}

未实现的功能

负载均衡、熔断、缓存、限流、鉴权