Compare commits
10 Commits
909cda9ffb
...
5551affe3e
| Author | SHA1 | Date | |
|---|---|---|---|
| 5551affe3e | |||
| a616cd6334 | |||
| 05a456b461 | |||
| 056583b542 | |||
| 2ed893e70d | |||
| 23eaf725b6 | |||
| 2354af516c | |||
| 209c1ba15d | |||
| 895d346bb6 | |||
| 940e5bb90c |
@@ -5,13 +5,47 @@ import java.util.Properties;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
|
||||
public interface AdapterErrorMessageHandler {
|
||||
/**
|
||||
* 비표준 -> 표준 거래
|
||||
* 아웃바운드 DefaultProcess에서 응답 표준헤더에 에러응답이 세팅되어 있는 경우, 비표준 응답 메시지 생성용
|
||||
*/
|
||||
public Object generateNonStandardErrorResponseMessage(String inboudnAdapterGroupName, String inboudnAdapterName,
|
||||
Properties callProp, Object outboundRequestData, EAIMessage resEaiMsg) throws Exception;
|
||||
|
||||
/**
|
||||
* 비표준 -> 표준 거래
|
||||
* GW 내부 오류가 발생한 경우, RequestPrcessor에서 에러 응답을 생성하는 경우, ExceptionHandler에 의해 호출, 비표준 응답 메시지 생성용
|
||||
*/
|
||||
public Object generateNonStandardInternalErrorResponseMessage(String inboudnAdapterGroupName,
|
||||
String inboudnAdapterName, Properties callProp, Object inboundRequestData, EAIMessage resEaiMsg)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* 비표준 -> 표준 거래
|
||||
* GW RequestProcess 호출 전에 Adapter(Filter)에서 오류가 발생한 경우, ApiAdapterController에 Exception에 맞추어, 비표준 응답 메시지 생성용
|
||||
*/
|
||||
public Object generateNonStandardInboundErrorResponseMessage(String inboudnAdapterGroupName,
|
||||
String inboudnAdapterName, Properties callProp, Object inboundRequestData, Object inboundResponseData,
|
||||
Throwable e) throws Exception;
|
||||
|
||||
/**
|
||||
* 표준 -> 비표준 거래
|
||||
* 아웃바운드 어댑터에서 Exception이 발생했을 때, Outbound 어댑터에 의해서 호출하여 응답 메시지 생성
|
||||
* 수신한 응답 메시지가 있을 수도 있고 없을 수도 있다.
|
||||
*/
|
||||
default public Object generateOutboundErrorResponseMessage(String outboundadapterGroupName,
|
||||
String outboundadapterName, Properties callProp, Object outboundRequestData, Object outboundResponseData,
|
||||
Throwable e) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object generateNonStandardInboundErrorResponseMessage(String adapterGroupName, String adapterName,
|
||||
Properties callProp, Object inboundRequestData, Object inboundResponseData, Throwable e) throws Exception;
|
||||
/**
|
||||
* 표준 -> 비표준 거래
|
||||
* 아웃바운드 어댑터에서 Exception이 발생했을 때, Outbound Process 응답 메시지 생성
|
||||
*/
|
||||
default public Object generateOutboundErrorResponseMessage(String outboundadapterGroupName,
|
||||
String outboundadapterName, Properties callProp, Object outboundRequestData, EAIMessage resEaiMsg)
|
||||
throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,6 +442,22 @@ public class TemplateAdapterErrorMsgHandler implements AdapterErrorMessageHandle
|
||||
HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 표준 -> 비표준 거래
|
||||
* 아웃바운드 어댑터에서 Exception이 발생했을 때, Outbound Process 응답 메시지 생성
|
||||
*/
|
||||
@Override
|
||||
public Object generateOutboundErrorResponseMessage(String outboundadapterGroupName,
|
||||
String outboundadapterName, Properties callProp, Object outboundRequestData, EAIMessage resEaiMsg)
|
||||
throws Exception {
|
||||
String templateKey = outboundadapterGroupName + ".template";
|
||||
String template = PropManager.getInstance().getProperty(PROP_GROUP, templateKey);
|
||||
if (StringUtils.isBlank(template)) {
|
||||
return null;
|
||||
}
|
||||
return render(template, resEaiMsg.getStandardMessage(), callProp);
|
||||
}
|
||||
|
||||
private Object genInboundErrorResponse(String adapterGroupName, Properties callProp, Properties httpProp,
|
||||
String adptMsgType, String encode, Throwable e1, int httpCode) {
|
||||
|
||||
+6
-8
@@ -36,7 +36,6 @@ import org.apache.hc.client5.http.classic.methods.HttpPost;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpPut;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase;
|
||||
import org.apache.hc.client5.http.config.RequestConfig;
|
||||
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
|
||||
import org.apache.hc.core5.http.ContentType;
|
||||
@@ -76,6 +75,7 @@ import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.message.MessageType;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.CommonLib;
|
||||
import com.eactive.eai.common.util.JSONUtils;
|
||||
import com.eactive.eai.common.util.TxFileLogger;
|
||||
import com.eactive.eai.common.util.XMLUtils;
|
||||
import com.jayway.jsonpath.DocumentContext;
|
||||
@@ -209,11 +209,13 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
}
|
||||
|
||||
HttpClient mclient = this.client;
|
||||
String sendData = "";
|
||||
Object sendData = "";
|
||||
if (data instanceof String) {
|
||||
sendData = (String) data;
|
||||
sendData = data;
|
||||
} else if (data instanceof byte[]) {
|
||||
sendData = new String((byte[]) data, vo.getEncode());
|
||||
} else if (data instanceof JSONObject) {
|
||||
sendData = data;
|
||||
}
|
||||
|
||||
////mclient.getParams().setContentCharset(vo.getEncode());
|
||||
@@ -224,7 +226,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
|
||||
if (MessageType.JSON.equals(messageType)) {
|
||||
|
||||
Object parsed = parseJsonGeneric(sendData);
|
||||
Object parsed = JSONUtils.parseJsonGeneric(sendData);
|
||||
|
||||
if(parsed instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) parsed;
|
||||
@@ -235,10 +237,6 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
|
||||
dataObject = jsonObject;
|
||||
|
||||
if (jsonObject.containsKey("innerList")) {
|
||||
JSONArray innerList = (JSONArray) jsonObject.get("innerList");
|
||||
dataObject = innerList;
|
||||
}
|
||||
} else if(parsed instanceof JSONArray) {
|
||||
// not support
|
||||
}
|
||||
|
||||
+50
-28
@@ -21,16 +21,19 @@ import com.eactive.eai.inbound.processor.Processor;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
import org.apache.hc.core5.http.ContentType;
|
||||
import org.apache.mina.common.ByteBuffer;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
import org.springframework.jms.support.converter.MessageType;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
@@ -212,6 +215,7 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
||||
|
||||
stopWatch.stop();
|
||||
|
||||
byte[] responseBytes = null;
|
||||
String responseData = "";
|
||||
if (RESPONSE_TYPE_ASYNC.equals(responseType)){
|
||||
if (stopWatch.getTime() > slowTranTime){
|
||||
@@ -222,17 +226,22 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
||||
|
||||
if ( result == null) {
|
||||
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName);
|
||||
responseBytes = responseData.getBytes();
|
||||
} else if (result instanceof byte[]) {
|
||||
responseData = new String((byte[]) result, encode);
|
||||
responseBytes = (byte[]) result;
|
||||
} else if (result instanceof String) {
|
||||
responseData = (String) result;
|
||||
if ( StringUtils.isBlank( responseData ) ) {
|
||||
responseBytes = ((String)result).getBytes();
|
||||
if ( StringUtils.isBlank((String)result ) ) {
|
||||
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName, adptName);
|
||||
responseBytes = responseData.getBytes();
|
||||
}
|
||||
}
|
||||
|
||||
response.setCharacterEncoding(encode);
|
||||
response.getWriter().print(responseData);
|
||||
// response.getWriter().print(responseData);
|
||||
response.getOutputStream().write(responseBytes);
|
||||
|
||||
if (traceLevel >= 3){
|
||||
HttpMemoryLogger.txlog(adptGrpName+adptName, "SEND "+"["+responseData+"]"+
|
||||
((responseData == null)?"":CommonLib.getDumpMessage(responseData))
|
||||
@@ -240,45 +249,58 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
||||
}
|
||||
} else {
|
||||
if(requestBytes != null) {
|
||||
if (result instanceof byte[]) {
|
||||
if ( result == null) {
|
||||
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName);
|
||||
responseBytes = responseData.getBytes();
|
||||
} else if (result instanceof byte[]) {
|
||||
responseData = new String((byte[]) result, encode);
|
||||
responseBytes = (byte[]) result;
|
||||
} else if (result instanceof String) {
|
||||
responseData = (String) result;
|
||||
responseBytes = ((String)result).getBytes();
|
||||
if ( StringUtils.isBlank((String)result ) ) {
|
||||
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName, adptName);
|
||||
responseBytes = responseData.getBytes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
logger.info("종료 >> encode = [" + encode + "]");
|
||||
|
||||
if (addData.length() > 0){
|
||||
responseData = addData + responseData;
|
||||
responseBytes = responseData.getBytes();
|
||||
}
|
||||
|
||||
try {
|
||||
Object root = JSONValue.parse(responseData);
|
||||
if( root instanceof JSONObject ) {
|
||||
JSONObject wrappedObject = (JSONObject) root;
|
||||
responseData = wrappedObject.get("DJB_ROOTLESS_ARRAY").toString();
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
// ignore json이 아니기에 해줄것이 없음.
|
||||
}
|
||||
// try {
|
||||
// Object root = JSONValue.parse(responseData);
|
||||
// if( root instanceof JSONObject ) {
|
||||
// JSONObject wrappedObject = (JSONObject) root;
|
||||
// responseData = wrappedObject.get("DJB_ROOTLESS_ARRAY").toString();
|
||||
// }
|
||||
//
|
||||
// }catch (Exception e) {
|
||||
// // ignore json이 아니기에 해줄것이 없음.
|
||||
// }
|
||||
|
||||
// 300응답에서 받은 Header정보 사용하기 위해 읽어옴.
|
||||
Map<String, Object> responsePropertyMap = (Map<String, Object>) prop.get(OUTBOUND_PROPERTY_MAP);
|
||||
if(responsePropertyMap != null){
|
||||
Properties responseHeaders = (Properties)responsePropertyMap.get(OUTBOUND_RESPONSE_HEADERS);
|
||||
Map<String, String> responseHeaderMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
// Properties 내용을 모두 복사
|
||||
for (String name : responseHeaders.stringPropertyNames()) {
|
||||
responseHeaderMap.put(name, responseHeaders.getProperty(name));
|
||||
}
|
||||
String contentTytpe = responseHeaderMap.get("Content-Type");
|
||||
response.setContentType(contentTytpe); // 300응답에서 받은 Content-Type을 그대로 적용.
|
||||
}
|
||||
// Map<String, Object> responsePropertyMap = (Map<String, Object>) prop.get(OUTBOUND_PROPERTY_MAP);
|
||||
// if(responsePropertyMap != null){
|
||||
// Properties responseHeaders = (Properties)responsePropertyMap.get(OUTBOUND_RESPONSE_HEADERS);
|
||||
// Map<String, String> responseHeaderMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
// // Properties 내용을 모두 복사
|
||||
// for (String name : responseHeaders.stringPropertyNames()) {
|
||||
// responseHeaderMap.put(name, responseHeaders.getProperty(name));
|
||||
// }
|
||||
// String contentTytpe = responseHeaderMap.get("Content-Type");
|
||||
// response.setContentType(contentTytpe); // 300응답에서 받은 Content-Type을 그대로 적용.
|
||||
// }
|
||||
|
||||
// UI와 통신시(UTF-8) 변환오류로 ENCODE 제거
|
||||
response.setCharacterEncoding(encode);
|
||||
response.getWriter().print(responseData);
|
||||
// response.getWriter().print(responseData);
|
||||
String resContentType = request.getContentType();
|
||||
response.setContentType(resContentType);
|
||||
response.getOutputStream().write(responseBytes);
|
||||
|
||||
if (logger.isDebug()){
|
||||
logger.debug("HttpAdapter] SEND ("+adptGrpName+") = [" + responseData + "]");
|
||||
logger.debug("HttpAdapter] SEND ("+adptGrpName+") = " +
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.eactive.eai.common.message;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.message.StandardMessage;
|
||||
import com.eactive.eai.message.manager.StandardMessageManager;
|
||||
@@ -109,7 +109,8 @@ public class EAIMessage implements EAIMessageKeys, Serializable, Comparable<EAIM
|
||||
private String authkeyfieldname;
|
||||
|
||||
private String authCheckdYn;
|
||||
|
||||
|
||||
private Properties callProp;
|
||||
|
||||
public EAIMessage() {
|
||||
this.svcMsgs = new ArrayList<>();
|
||||
@@ -664,6 +665,14 @@ public class EAIMessage implements EAIMessageKeys, Serializable, Comparable<EAIM
|
||||
public Map<String, Object> getTransactionContextTransfer() {
|
||||
return transactionContextTransfer;
|
||||
}
|
||||
|
||||
public Properties getCallProp() {
|
||||
return callProp;
|
||||
}
|
||||
|
||||
public void setCallProp(Properties callProp) {
|
||||
this.callProp = callProp;
|
||||
}
|
||||
|
||||
/**
|
||||
* [비동기 전달 전용] 컨텍스트 전달용 Map 설정
|
||||
|
||||
@@ -49,9 +49,10 @@ public class STDMessageDAO extends BaseDAO {
|
||||
for (StandardMessageInfo info : list) {
|
||||
vo = standardManager.getStandardMessage();
|
||||
vo.setServiceKey(info.getBzwksvckeyname());
|
||||
vo.setEaiSvcCd(info.getEaisvcname());
|
||||
// TODO
|
||||
// to be defined...
|
||||
mapper.setInterfaceId(vo, info.getEaitranname());
|
||||
// mapper.setInterfaceId(vo, info.getEaitranname());
|
||||
mapper.setSendRecvDivision(vo, info.getEaisendrecv()); // S | R
|
||||
mapper.setInExDivision(vo, info.getEaidirection()); // 1 | 2
|
||||
List<StandardMessageItem> items = info.getStandardMessageItems();
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
public class JSONUtils {
|
||||
@@ -19,6 +20,30 @@ public class JSONUtils {
|
||||
private JSONUtils() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static Object parseJsonGeneric(Object jsonData) {
|
||||
if (jsonData == null) {
|
||||
return new JSONObject();
|
||||
}
|
||||
if (jsonData instanceof JSONObject) {
|
||||
return (JSONObject) jsonData;
|
||||
} else if (jsonData instanceof String) {
|
||||
if (StringUtils.isBlank((String) jsonData)) {
|
||||
return new JSONObject();
|
||||
}
|
||||
try {
|
||||
JSONParser parser = new JSONParser();
|
||||
Object parsedObj = parser.parse((String) jsonData);
|
||||
return parsedObj;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else
|
||||
throw new IllegalArgumentException("not support json type. " + jsonData.getClass());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JSONObject parseJson(Object message) {
|
||||
if (message == null) {
|
||||
|
||||
@@ -415,6 +415,10 @@ public final class MessageUtil {
|
||||
if ("RECEAIIRP072".equals(oldErrCode)) { // 유량제어 초과 에러
|
||||
return STDMessageErrorKeys.RATELIMIT_ERROR_CODE_VALUE;
|
||||
}
|
||||
if ("RECEAIOHP201".equals(oldErrCode)) { // CIRCUITBREAKER 초과 에러
|
||||
return STDMessageErrorKeys.RATELIMIT_ERROR_CODE_VALUE;
|
||||
}
|
||||
|
||||
if (EAIServiceMonitor.getInstance().isTimeOutCodes(oldErrCode)){ //TIMEOUT일경우
|
||||
return STDMessageErrorKeys.TIMEOUT_ERROR_CODE_VALUE;
|
||||
}else if (EAIServiceMonitor.getInstance().isBizErrorCodes(oldErrCode)){ //업무오류일경우
|
||||
@@ -448,6 +452,9 @@ public final class MessageUtil {
|
||||
if ("RECEAIIRP072".equals(oldErrCode)) { // 유량제어 초과 에러
|
||||
return STDMessageErrorKeys.RATELIMIT_ERROR_MSG_VALUE;
|
||||
}
|
||||
if ("RECEAIOHP201".equals(oldErrCode)) { // CIRCUITBREAKER 초과 에러
|
||||
return STDMessageErrorKeys.RATELIMIT_ERROR_MSG_VALUE;
|
||||
}
|
||||
if (EAIServiceMonitor.getInstance().isTimeOutCodes(oldErrCode) ){ //TIMEOUT일경우
|
||||
return STDMessageErrorKeys.TIMEOUT_ERROR_MSG_VALUE;
|
||||
}else if (EAIServiceMonitor.getInstance().isBizErrorCodes(oldErrCode)){ //업무오류일경우
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Properties;
|
||||
|
||||
public class TxFileLogger {
|
||||
|
||||
public static void logTxFile(Properties transactionProp, String message, String prefix) {
|
||||
public static void logTxFile(Properties transactionProp, Object message, String prefix) {
|
||||
Logger siftLogger = Logger.getLogger(Logger.LOGGER_SIFT);
|
||||
if (siftLogger.isInfoEnabled()) {
|
||||
siftLogger.info(prefix + message);
|
||||
|
||||
@@ -4,9 +4,6 @@ import java.util.Calendar;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.context.ElinkTransactionContext;
|
||||
import com.eactive.eai.common.util.*;
|
||||
@@ -25,7 +22,6 @@ import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
|
||||
import com.eactive.eai.common.bizkey.BizKeyManager;
|
||||
import com.eactive.eai.common.bizkey.BizKeyVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeHandler;
|
||||
import com.eactive.eai.common.exception.ExceptionHandler;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.inflow.Bucket;
|
||||
@@ -59,9 +55,6 @@ import com.eactive.eai.message.service.InterfaceMapper;
|
||||
import com.eactive.eai.util.SimHeaderUtil;
|
||||
import com.ext.eai.common.stdmessage.STDMessageKeys;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.springframework.http.HttpStatus;
|
||||
|
||||
@@ -464,7 +457,9 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
logUnknownMessage(vo,orgMessage);
|
||||
return getInboundErrorResponse(prop, standardMessage, mapper, vo.getRspErrorCode(), vo.getRspErrorMsg(), inboundCharset);
|
||||
}
|
||||
|
||||
|
||||
eaiMsg.setCallProp(prop);
|
||||
|
||||
// set standardMessage & mapper to EAIMessage
|
||||
eaiMsg.setStandardMessage(standardMessage);
|
||||
eaiMsg.setMapper(mapper);
|
||||
@@ -475,7 +470,9 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
if(svrLogLevel >= 1) {
|
||||
if (esbLogger.isInfo()) esbLogger.info("RequestProcessor] started... - EAI Server Log Level is INFO");
|
||||
}
|
||||
|
||||
|
||||
afterFoundEaiMessage(eaiMsg, vo, prop);
|
||||
|
||||
// 3-1. 수신메시지와 초기값을 EAIMessage에 설정한다.
|
||||
// 메시지 수신시각 설정
|
||||
eaiMsg.setMsgRcvTm(vo.getErrTm());
|
||||
@@ -1256,7 +1253,7 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
|
||||
beforeRoute(eaiMsg, prop);
|
||||
retEaiMsg = FlowRouter.process(eaiMsg, prop);
|
||||
|
||||
retEaiMsg.setCallProp(prop);
|
||||
// 응답메시지에 Error Code기 설정되어 있을 경우
|
||||
// ExceptionHandler를 통해 응답메시지를 생성한다.
|
||||
if(retEaiMsg != null && !MessageUtil.checkRspErrCd(retEaiMsg.getRspErrCd())) {
|
||||
@@ -1396,6 +1393,10 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterFoundEaiMessage(EAIMessage eaiMsg, ProcessVO vo, Properties prop) {
|
||||
}
|
||||
|
||||
|
||||
protected String checkCustomInflow(Bucket bucket, EAIMessage eaiMsg, Properties prop) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ import com.eactive.eai.message.filter.MessageFilter;
|
||||
public class StandardMessage extends StandardItem {
|
||||
private static final long serialVersionUID = 8250470942348479859L;
|
||||
static Logger logger = LoggerFactory.getLogger(StandardMessage.class);
|
||||
|
||||
String eaiSvcCd = null;
|
||||
|
||||
int readPosition = 0;
|
||||
|
||||
private String serviceKey = null;
|
||||
@@ -30,6 +33,14 @@ public class StandardMessage extends StandardItem {
|
||||
|
||||
private MessageFilter flatFilter = null;
|
||||
|
||||
public String getEaiSvcCd() {
|
||||
return eaiSvcCd;
|
||||
}
|
||||
|
||||
public void setEaiSvcCd(String eaiSvcCd) {
|
||||
this.eaiSvcCd = eaiSvcCd;
|
||||
}
|
||||
|
||||
public String getBizDataCharset() {
|
||||
return bizDataCharset;
|
||||
}
|
||||
|
||||
@@ -292,10 +292,10 @@ public class StandardMessageUtil {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (curItem.getType() == StandardType.BIZDATA) {
|
||||
message.setBizDataPath(getFullPath(parentPath, curItem.getName()));
|
||||
logger.debug("@@@ BIZ DATA PATH = {}", message.getBizDataPath());
|
||||
}
|
||||
// if (curItem.getType() == StandardType.BIZDATA) {
|
||||
// message.setBizDataPath(getFullPath(parentPath, curItem.getName()));
|
||||
// logger.debug("@@@ BIZ DATA PATH = {}", message.getBizDataPath());
|
||||
// }
|
||||
|
||||
if (curItem.getDataType() == StandardDataType.LL_NUMBER) {
|
||||
message.setLlDataPath(getFullPath(parentPath, curItem.getName()));
|
||||
|
||||
@@ -334,6 +334,8 @@ reader.FLAT=com.eactive.eai.message.parser.FlatReader
|
||||
}
|
||||
if(logger.isDebug()) logger.debug("mapperClass : {}", mapper.getClass().getCanonicalName());
|
||||
|
||||
standardMessage.setBizDataPath(mapper.getPath(InterfaceMapper.BIZ_DATA));
|
||||
|
||||
String versionMapperClass = config.getProperty(VERSION_MAPPER);
|
||||
if(StringUtils.isEmpty(versionMapperClass)) {
|
||||
versionMapperClass = "com.eactive.eai.message.mapper.DefaultMessageMapper";
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DefaultInterfaceMapper implements InterfaceMapper {
|
||||
itemPathMap = map;
|
||||
}
|
||||
|
||||
protected String getPath(String key) {
|
||||
public String getPath(String key) {
|
||||
String path = itemPathMap.get(key);
|
||||
if(StringUtils.isBlank(path)) {
|
||||
logger.debug("message-mapping not defined key = {}", key);
|
||||
|
||||
@@ -34,7 +34,11 @@ public interface InterfaceMapper extends Serializable {
|
||||
String RESPONSE_TYPE = "RESPONSE_TYPE";
|
||||
String SYNC_ASYNC_TYPE = "SYNC_ASYNC_TYPE";
|
||||
|
||||
String BIZ_DATA = "BIZ_DATA";
|
||||
|
||||
public void initPathMap(HashMap<String, String> map);
|
||||
|
||||
public String getPath(String key);
|
||||
//------------------------------------------------------------
|
||||
// 표준전문과 Mapping 되는 항목을 모두 정의해야 함.
|
||||
//------------------------------------------------------------
|
||||
|
||||
@@ -776,8 +776,9 @@ public abstract class DefaultProcess extends Process {
|
||||
if(this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP) instanceof Map) {
|
||||
Map<String, Object> map = (Map<String, Object>) this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP);
|
||||
this.resObject = map.get(HttpAdapterServiceKey.OUTBOUND_RESPONSE_MESSAGE);
|
||||
this.callProp.put(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP, map);
|
||||
}
|
||||
standardMessage.setBizData(this.resObject, this.inboundCharset);
|
||||
standardMessage.setBizData(this.resObject, this.inboundCharset);
|
||||
try {
|
||||
//mapper.nextGuidSeq(standardMessage);
|
||||
mapper.setSendRecvDivision(standardMessage, STDMessageKeys.SEND_RECV_CD_RECV);
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
package com.eactive.eai.outbound;
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.circuitBreaker.CircuitBreakerManager;
|
||||
import com.eactive.eai.common.circuitBreaker.type.TypedCircuitBreakerManager;
|
||||
import com.eactive.eai.message.StandardMessage;
|
||||
import com.eactive.eai.util.PropertiesUtil;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.initech.core.util.PropertiesManager;
|
||||
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.adapter.AdapterPropManager;
|
||||
import com.eactive.eai.adapter.AdapterVO;
|
||||
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandler;
|
||||
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandlerFactory;
|
||||
import com.eactive.eai.adapter.http.HttpStatusException;
|
||||
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
|
||||
import com.eactive.eai.common.EAIKeys;
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.circuitBreaker.CircuitBreakerManager;
|
||||
import com.eactive.eai.common.circuitBreaker.type.TypedCircuitBreakerManager;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.header.HeaderAction;
|
||||
import com.eactive.eai.common.header.HeaderActionFactory;
|
||||
@@ -43,14 +39,16 @@ import com.eactive.eai.common.worker.ResponseMap;
|
||||
import com.eactive.eai.control.HttpSender;
|
||||
import com.eactive.eai.control.LogSender;
|
||||
import com.eactive.eai.control.Transform;
|
||||
import com.eactive.eai.custom.alarm.AlarmStateManager;
|
||||
import com.eactive.eai.custom.alarm.condition.AlarmCondition;
|
||||
import com.eactive.eai.custom.alarm.event.AlarmEvent;
|
||||
import com.eactive.eai.custom.alarm.key.AlarmKey;
|
||||
import com.eactive.eai.custom.alarm.key.CoreAlarmKey;
|
||||
import com.eactive.eai.env.ElinkConfig;
|
||||
import com.eactive.eai.inbound.processor.Processor;
|
||||
import com.eactive.eai.message.StandardMessage;
|
||||
import com.eactive.eai.util.PropertiesUtil;
|
||||
import com.ext.eai.common.stdmessage.STDMessageKeys;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
|
||||
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
|
||||
|
||||
public class RESTProcess extends HTTPProcess {
|
||||
static final long serialVersionUID = 1L;
|
||||
@@ -148,6 +146,16 @@ public class RESTProcess extends HTTPProcess {
|
||||
logger.error(guidLogPrefix + rspErrorMsg, hse);
|
||||
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
|
||||
throw new RuntimeException(rspErrorCode);
|
||||
|
||||
} catch (CallNotPermittedException e) {
|
||||
String[] msgArgs = new String[1];
|
||||
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
|
||||
String rspErrorCode = "RECEAIOHP201";
|
||||
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
|
||||
if (logger.isError())
|
||||
logger.error(guidLogPrefix + rspErrorMsg, e);
|
||||
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
|
||||
throw new RuntimeException(rspErrorCode);
|
||||
} catch (Exception e) {
|
||||
String[] msgArgs = new String[1];
|
||||
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
|
||||
@@ -682,5 +690,44 @@ public class RESTProcess extends HTTPProcess {
|
||||
public void storeMessage() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
public void setOutboundErrorMessage() throws Exception {
|
||||
this.logPssSno = TranLogUtil.getResLogSeq(this.svcPssTp, this.svcPssSeq, this.isComp);
|
||||
|
||||
boolean setResObject = false;
|
||||
AdapterGroupVO outboundAdapterGroupVO = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||
if (outboundAdapterGroupVO != null) {
|
||||
AdapterVO outboundAdapterVo = null;
|
||||
if(adapterName != null)
|
||||
outboundAdapterVo = outboundAdapterGroupVO.getAdapterVO(adapterName);
|
||||
else
|
||||
outboundAdapterVo = outboundAdapterGroupVO.nextAdapterVO();
|
||||
|
||||
if (outboundAdapterVo != null) {
|
||||
String errorHandlerClass = AdapterPropManager.getInstance().getProperty(
|
||||
outboundAdapterVo.getPropGroupName(), "ERR_MSG_HANDLER");
|
||||
if (StringUtils.isNotBlank(errorHandlerClass)) {
|
||||
if (logger.isInfo())
|
||||
logger.info("ExceptionHandler] errorSyncSend ERR_MSG_HANDLER=" + errorHandlerClass);
|
||||
AdapterErrorMessageHandler handler = AdapterErrorMessageHandlerFactory.createHandler(errorHandlerClass);
|
||||
this.resObject = handler.generateOutboundErrorResponseMessage(adapterGroupName, adapterGroupName,
|
||||
callProp, this.reqObject, this.resEaiMsg);
|
||||
setResObject = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!setResObject) {
|
||||
this.resObject = "";
|
||||
}
|
||||
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
|
||||
standardMessage.setBizData(this.resObject, this.inboundCharset);
|
||||
|
||||
// 에러에 대한 응답메시지
|
||||
if(this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP) instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = (Map<String, Object>) this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP);
|
||||
this.callProp.put(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP, map);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user