RequestProcessor 메소드 시그니쳐 변경

This commit is contained in:
curry772
2026-05-27 10:32:30 +09:00
parent 7415828e82
commit 29a486bf9b
@@ -956,10 +956,7 @@ public class RequestProcessor extends RequestProcessorSupport {
// 거래통제 대상 거래일 경우 '1'로 설정한다. // 거래통제 대상 거래일 경우 '1'로 설정한다.
eaiMsg.setSvcTmEn(EAIMessageKeys.YES_FLAG); eaiMsg.setSvcTmEn(EAIMessageKeys.YES_FLAG);
vo.setRspErrorCode(EAIMessageKeys.EAI_BLOCKED_CODE); vo.setRspErrorCode(EAIMessageKeys.EAI_BLOCKED_CODE);
vo.setRspErrorMsg(ExceptionUtil.make(vo.getRspErrorCode(), new String[]{vo.getEaiSvcCd()})); vo.setRspErrorMsg(buildRestrictErrorMsg(eaiMsg, prop));
// eaiMsg.setRspErrCd(vo.getRspErrorCode());
// eaiMsg.setRspErrMsg(vo.getRspErrorMsg());
eaiMsg.setRspErr(vo.getRspErrorCode(),vo.getRspErrorMsg()); eaiMsg.setRspErr(vo.getRspErrorCode(),vo.getRspErrorMsg());
// 거래통제 로그에 로그생성 // 거래통제 로그에 로그생성
@@ -1033,9 +1030,8 @@ public class RequestProcessor extends RequestProcessorSupport {
Bucket bucket = InflowControlUtil.getBucket(); Bucket bucket = InflowControlUtil.getBucket();
String blockedType = ""; String blockedType = "";
// Client 유량제어 체크 — clientId가 있는 경우에만 String customBlockedType = checkCustomInflow(bucket, eaiMsg, prop);
String clientBlockedType = checkClientInflow(bucket, clientId); if (customBlockedType != null) {
if (clientBlockedType != null) {
blockedType += "C"; blockedType += "C";
} }
// Adapter 유량제어 체크 // Adapter 유량제어 체크
@@ -1066,7 +1062,7 @@ public class RequestProcessor extends RequestProcessorSupport {
InflowTargetVO inflowTargetVO = null; InflowTargetVO inflowTargetVO = null;
InflowGroupVO inflowGroupVO = null; InflowGroupVO inflowGroupVO = null;
if (blockedType.startsWith("C")) { if (blockedType.startsWith("C")) {
inflowTargetVO = resolveClientInflowThreshold(bucket, clientId); inflowTargetVO = resolveCustomInflowThreshold(bucket, eaiMsg, prop);
} else if (blockedType.startsWith("A")) { } else if (blockedType.startsWith("A")) {
inflowTargetVO = bucket.getAdapterInflowThreashold(vo.getAdapterGroupName()); inflowTargetVO = bucket.getAdapterInflowThreashold(vo.getAdapterGroupName());
} else if (blockedType.contains("G")) { } else if (blockedType.contains("G")) {
@@ -1089,7 +1085,7 @@ public class RequestProcessor extends RequestProcessorSupport {
} }
} else if (inflowTargetVO != null) { } else if (inflowTargetVO != null) {
String targetBlockedType; String targetBlockedType;
if (blockedType.startsWith("C")) targetBlockedType = clientBlockedType; if (blockedType.startsWith("C")) targetBlockedType = customBlockedType;
else if (blockedType.startsWith("A")) targetBlockedType = adapterBlockedType; else if (blockedType.startsWith("A")) targetBlockedType = adapterBlockedType;
else targetBlockedType = interfaceBlockedType; else targetBlockedType = interfaceBlockedType;
inflowErrorMsg = buildInflowTargetErrorMsg(inflowTargetVO, targetBlockedType); inflowErrorMsg = buildInflowTargetErrorMsg(inflowTargetVO, targetBlockedType);
@@ -1257,7 +1253,8 @@ public class RequestProcessor extends RequestProcessorSupport {
if(svrLogLevel >= 1 && esbLogger.isInfo()) { if(svrLogLevel >= 1 && esbLogger.isInfo()) {
esbLogger.info(guidLogPrefix + " : FlowControl ROUTING_TYPE [" + prop.getProperty(RouteKeys.ROUTING_TYPE) + "]"); esbLogger.info(guidLogPrefix + " : FlowControl ROUTING_TYPE [" + prop.getProperty(RouteKeys.ROUTING_TYPE) + "]");
} }
beforeRoute(eaiMsg, prop);
retEaiMsg = FlowRouter.process(eaiMsg, prop); retEaiMsg = FlowRouter.process(eaiMsg, prop);
// 응답메시지에 Error Code기 설정되어 있을 경우 // 응답메시지에 Error Code기 설정되어 있을 경우
@@ -1285,8 +1282,9 @@ public class RequestProcessor extends RequestProcessorSupport {
throw new RequestProcessorException(vo.getRspErrorMsg()); throw new RequestProcessorException(vo.getRspErrorMsg());
} }
} }
afterRoute(eaiMsg, retEaiMsg, prop);
// TODO : StandardMessage -> SubMessage
// TODO : StandardMessage -> SubMessage
if(Keys.IF_SUBSTANDARD.equals(vo.getStdMsgTypeCode())) { if(Keys.IF_SUBSTANDARD.equals(vo.getStdMsgTypeCode())) {
StandardMessage stdMessage = retEaiMsg.getStandardMessage(); StandardMessage stdMessage = retEaiMsg.getStandardMessage();
try { try {
@@ -1398,12 +1396,11 @@ public class RequestProcessor extends RequestProcessorSupport {
} }
} }
// 클라이언트 유량제어 체크 훅 — 기본 구현은 체크 없음, DJErpRequestProcessor가 오버라이드 protected String checkCustomInflow(Bucket bucket, EAIMessage eaiMsg, Properties prop) {
protected String checkClientInflow(Bucket bucket, String clientId) {
return null; return null;
} }
protected InflowTargetVO resolveClientInflowThreshold(Bucket bucket, String clientId) { protected InflowTargetVO resolveCustomInflowThreshold(Bucket bucket, EAIMessage eaiMsg, Properties prop) {
return null; return null;
} }
@@ -1420,6 +1417,14 @@ public class RequestProcessor extends RequestProcessorSupport {
return String.format("API 호출 한도 초과 [%s]", inflowTargetVO.getName()); return String.format("API 호출 한도 초과 [%s]", inflowTargetVO.getName());
} }
protected String buildRestrictErrorMsg(EAIMessage eaiMsg, Properties prop) {
return ExceptionUtil.make(EAIMessageKeys.EAI_BLOCKED_CODE, new String[]{eaiMsg.getEAISvcCd()});
}
protected void beforeRoute(EAIMessage eaiMsg, Properties prop) {}
protected void afterRoute(EAIMessage reqMsg, EAIMessage retMsg, Properties prop) {}
protected String getInboundErrorResponse(Properties prop, StandardMessage standardMessage, InterfaceMapper mapper protected String getInboundErrorResponse(Properties prop, StandardMessage standardMessage, InterfaceMapper mapper
, String errCode, String errMsg, String charset) { , String errCode, String errMsg, String charset) {
String errorResponse = null; String errorResponse = null;