ElinkTransactionContext 작업(변환 함수에 값 전달 체계 추가)
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package com.eactive.eai.common.routing;
|
||||
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.eactive.eai.common.context.ElinkTransactionContext;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
import com.eactive.eai.common.message.EAIMessageKeys;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : ElinkESBProcess를 호출하는 공통 Class
|
||||
@@ -42,17 +44,30 @@ public class ElinkESBProcessProxy
|
||||
public static EAIMessage callElinkESBProcess(String serviceURI, EAIMessage eaiMessage, boolean isLocal, Properties prop) throws Exception
|
||||
{
|
||||
EAIMessage retMsg = null;
|
||||
|
||||
// [ElinkTransactionContext] 비동기 거래 시 컨텍스트 초기화 여부 판단
|
||||
// - ASYNC 거래이고, outbound Process 호출이 아닌 경우에만 초기화
|
||||
boolean shouldManageContext = eaiMessage != null
|
||||
&& EAIMessageKeys.ASYNC_SVC.equals(eaiMessage.getSvcTsmtUsgTp())
|
||||
&& (serviceURI == null || !serviceURI.startsWith("com.eactive.eai.outbound"));
|
||||
|
||||
try {
|
||||
if (isLocal){
|
||||
// [ElinkTransactionContext] 비동기 거래 진입점 - 컨텍스트 복원
|
||||
if (shouldManageContext) {
|
||||
ElinkTransactionContext.restore(eaiMessage.getTransactionContextTransfer());
|
||||
eaiMessage.setTransactionContextTransfer(null); // 복원 후 전달용 필드 초기화
|
||||
}
|
||||
|
||||
if (isLocal){
|
||||
Class cl = classLocalCache.get(serviceURI);
|
||||
|
||||
|
||||
if(cl == null) {
|
||||
cl = Class.forName(serviceURI);
|
||||
classLocalCache.put(serviceURI, cl);
|
||||
}
|
||||
Process proc = (Process)cl.newInstance();
|
||||
proc.callService(eaiMessage, prop);
|
||||
|
||||
|
||||
retMsg = proc.clientReturn();
|
||||
}else{
|
||||
if(eaiMessage == null) {
|
||||
@@ -62,12 +77,17 @@ public class ElinkESBProcessProxy
|
||||
retMsg = RemoteProxyClient.callProxyBean(eaiMessage, prop);
|
||||
}
|
||||
}
|
||||
} catch( ClassNotFoundException e) {
|
||||
} catch( ClassNotFoundException e) {
|
||||
if (logger.isError()) logger.error("ElinkProcessProxy] callElinkESBProcess["+serviceURI+"] Class Not Found Exception : ");
|
||||
throw new Exception(PROXY_ERROR_CODE);
|
||||
} catch( Exception e) {
|
||||
throw new Exception(PROXY_ERROR_CODE);
|
||||
} catch( Exception e) {
|
||||
if (logger.isError()) logger.error("ElinkProcessProxy] callElinkESBProcess["+serviceURI+"] Exception : "+e.getMessage(),e);
|
||||
throw new Exception(PROXY_ERROR_CODE);
|
||||
throw new Exception(PROXY_ERROR_CODE);
|
||||
} finally {
|
||||
// [ElinkTransactionContext] 비동기 거래 - 해제
|
||||
if (shouldManageContext) {
|
||||
ElinkTransactionContext.clear();
|
||||
}
|
||||
}
|
||||
return retMsg;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.eactive.eai.common.routing;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.common.context.ElinkTransactionContext;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
@@ -136,6 +137,8 @@ public class FlowRouter
|
||||
}
|
||||
|
||||
try {
|
||||
// [ElinkTransactionContext] 비동기 송신 전 컨텍스트 복사
|
||||
eaiMessage.setTransactionContextTransfer(ElinkTransactionContext.getAll());
|
||||
JMSSender.sendToQueue(eaiMessage, queueConFactory, routeQueueName, prop);
|
||||
} catch(Exception e) {
|
||||
if (logger.isError()) logger.error(guidLogPrefix +" process.Queue Error. Queue Name[" + routeQueueName + "]- " + e.getMessage(), e);
|
||||
@@ -164,6 +167,8 @@ public class FlowRouter
|
||||
}
|
||||
|
||||
try {
|
||||
// [ElinkTransactionContext] 비동기 송신 전 컨텍스트 복사
|
||||
eaiMessage.setTransactionContextTransfer(ElinkTransactionContext.getAll());
|
||||
if (ElinkConfig.isUseCacheTopic()) {
|
||||
SessionManager.getInstance().putTopic(traceKey, eaiMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user