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