网关系统PipeLine设计

Pipelined System Implementation:

Define "pipe-execute-type" structure for Pile-lined system such as AccessGateway or Adaptor to decide from which layer to do logic process.

          Map each layer name to the process order when binding pipes together. (e.g. If in AccessGateway ,"Jwt auth" mapped to 1, "router" to 2, "desensitize" to 3.)

              a. If in AccessGateway, add the info into Http Header via Http rest invoking. If "pipe-execute-type" = "normal" or "execute_point_{order}" and order value <= currency layer order, then execute this layer process logic or just skip.

              b. If in Adaptor, add the info into http body via Json-RPC invoking.   If "pipe-execute-type" = "normal" or "execute_point_{order}" and order value <= currency layer order, then execute this layer process logic or just skip.

Router Implementation:

Define "route-type","region-uri" structure for router layer to route to target region service.  "route-type" including: "Local", "Region_XXX"  which indicating local processing or remote region node  XXX processing)

If in AccessGateway, add the info into http header via Http rest invoking

AccessGateway execution logic:

The execution order of AccessGateway is: jwt layer(1) → router layer(2) → desensitization layer(3). So when a request incoming, it will pass through as below logic

jwt layer: If "pipe-execute-type"="normal" or "execute_point_{order}" and order value <=1, then doing process logic(verify jwt ) or just skip.

router layer: If "pipe-execute-type"="normal" or "execute_point_{order}" and order value <=2, then doing below process logic or just skip.

If "route-type"="local", skip to next step.

If "route-type"="region_xxx", set "pipe-execute-type"="desensitize", fetch region uri of "xxx" from Config Center Cache and then http invoking to xxx region AccessGateway endpoint

desensitization layer: If "pipe-execute-type"="normal" or "execute_point_{order}" and order value <=3, then doing process logic(exchange card info with token) or just skip.

你可能感兴趣的:(网关系统PipeLine设计)