咏南反向网关服务注册

咏南反向网关服务注册

这是一款使用DELPHI开发的网关软件。

咏南反向网关是类似NGINX的网关。支持静态注册服务和动态注册服务。

1)静态注册服务

配置server.json,静态配置好后,需要重启网关,配置方能生效。必须先开启服务,再开启网关。

{
    "ssl":false,  //true--https,false--http
    "cert":"server.pem", //证书文件
    "privatekey":"server.key", //密钥文件
    "httpport":12345,  
    "threadnum":256,
    "connecttimeout":1000,
    "maxconnectnum":20000,
    "loadbalance":"loop",
    "services":
    [
        {
            "protocol":"http", //http,https
            "name":"goServer", //服务名
            "prefix":"http", //前缀:http,https
            "ip":"localhost",
            "port":9999
        }
    ]
}

2)动态注册服务

网关和服务没有先后开启顺序。

动态注册服务

向网关发“注册服务”的rest api

任何http get\post\put。。。方法都可以。

Demo

url: http://localhost:12345/serviceadd/{"name":"service1","prefix":"http","ip":"localhost","port":1234,"protocol":"http"}

 

3)动态注销服务

向网关发“注销服务”的rest api

任何http get\post\put。。。方法都可以。

Demo

url: http://localhost:12345/servicedelete/{"name":"service1"}

 

4)取服务列表

向网关发“服务列表”的rest api

任何http get\post\put。。。方法都可以。

Url:

http://localhost:12345/servicelist

 

posted @ 2023-01-30 17:36  delphi中间件  阅读(27)  评论(0编辑  收藏  举报