1. 统一网关未命中缓存时,进行兜底查询

2. loginUser 新增 mobile username 作为 userInfo 扩展内容
This commit is contained in:
chenbowen
2025-10-28 17:32:42 +08:00
parent 7aae0d0670
commit 04597fad6c
3 changed files with 16 additions and 3 deletions

View File

@@ -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));
}
}