1. 统一网关未命中缓存时,进行兜底查询
2. loginUser 新增 mobile username 作为 userInfo 扩展内容
This commit is contained in:
@@ -24,8 +24,7 @@ public class ApiFlowDispatcher {
|
||||
private final MessagingTemplate messagingTemplate;
|
||||
|
||||
public ApiInvocationContext dispatch(String apiCode, String version, ApiInvocationContext context) {
|
||||
MessageChannel channel = integrationFlowManager.locateInputChannel(apiCode, version)
|
||||
.orElseThrow(() -> ServiceExceptionUtil.exception(API_FLOW_NOT_FOUND, apiCode, version));
|
||||
MessageChannel channel = requireInputChannel(apiCode, version);
|
||||
Message<ApiInvocationContext> message = MessageBuilder.withPayload(context)
|
||||
.setHeader("apiCode", apiCode)
|
||||
.setHeader("version", version)
|
||||
@@ -36,4 +35,14 @@ public class ApiFlowDispatcher {
|
||||
}
|
||||
return (ApiInvocationContext) reply.getPayload();
|
||||
}
|
||||
|
||||
private MessageChannel requireInputChannel(String apiCode, String version) {
|
||||
// 未命中时,进行一次兜底补偿查询
|
||||
return integrationFlowManager.locateInputChannel(apiCode, version)
|
||||
.or(() -> {
|
||||
integrationFlowManager.refresh(apiCode, version);
|
||||
return integrationFlowManager.locateInputChannel(apiCode, version);
|
||||
})
|
||||
.orElseThrow(() -> ServiceExceptionUtil.exception(API_FLOW_NOT_FOUND, apiCode, version));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user