用户工具

站点工具


light4j:router
# handler.yml
handlers:
- com.networknt.cors.CorsHttpHandler@cors
- com.networknt.router.middleware.ServiceDictHandler@path
- com.networknt.router.RouterHandler@router
# serviceDict.yml,ServiceDictHandler,requestURI@method=>service_id,前缀匹配,考虑method
mapping:
  /v1/pets@get: com.networknt.petstore-1.0.0
# pathService.yml,PathServiceHandler,audit_info.endpoint=>service_id,精确匹配,依赖audit_info
mapping:
  /v1/address/{id}@get: party.address-1.0.0
# pathPrefixService.yml,PathPrefixServiceHandler,requestUri=>service_id,前缀匹配,忽略method
mapping:
  /v1/address: party.address-1.0.0
  • egress-router
    • RouterHandler,router.yml,使用io.undertow.server.handlers.proxy.ProxyHandler.builder()转发请求
    • LoadBalancingRouterProxyClient,selectHost方法读取service_url、service_id,通过cluster获取地址列表
light4j/router.txt · 最后更改: 2021/11/26 15:22 由 admin