Merge branch 'jenkins_with_weblogic' of ssh://git@192.168.240.178:18081/eapim/elink-online-common.git into jenkins_with_weblogic
This commit is contained in:
@@ -3,7 +3,9 @@ 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 com.eactive.eai.message.StandardMessage;
|
||||
import com.eactive.eai.message.manager.StandardMessageManager;
|
||||
@@ -108,6 +110,7 @@ public class EAIMessage implements EAIMessageKeys, Serializable, Comparable<EAIM
|
||||
|
||||
private String authCheckdYn;
|
||||
|
||||
|
||||
public EAIMessage() {
|
||||
this.svcMsgs = new ArrayList<>();
|
||||
this.svcPssSeq = 1;
|
||||
@@ -633,6 +636,42 @@ public class EAIMessage implements EAIMessageKeys, Serializable, Comparable<EAIM
|
||||
this.authCheckdYn = authCheckdYn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* [주의] 비동기 JMS 전달 전용 - 직접 사용 금지!
|
||||
*
|
||||
* 이 필드는 비동기 거래 시 JMS ObjectMessage 직렬화를 통해
|
||||
* Consumer 스레드로 컨텍스트를 전달하기 위한 용도로만 사용됩니다.
|
||||
*
|
||||
* 컨텍스트 값 읽기/쓰기는 반드시 ElinkTransactionContext를 사용하세요:
|
||||
* - ElinkTransactionContext.setSeedSalt() / getSeedSalt()
|
||||
* - ElinkTransactionContext.setEncryptionKey() / getEncryptionKey()
|
||||
*
|
||||
* 설정 위치:
|
||||
* - FlowRouter: getAll()로 복사하여 이 필드에 설정
|
||||
* - ElinkESBProcessProxy: 이 필드에서 restore()로 복원
|
||||
*
|
||||
* @see com.eactive.eai.common.context.ElinkTransactionContext
|
||||
*/
|
||||
private Map<String, Object> transactionContextTransfer;
|
||||
|
||||
/**
|
||||
* [비동기 전달 전용] 컨텍스트 전달용 Map 반환
|
||||
* @see #transactionContextTransfer
|
||||
*/
|
||||
public Map<String, Object> getTransactionContextTransfer() {
|
||||
return transactionContextTransfer;
|
||||
}
|
||||
|
||||
/**
|
||||
* [비동기 전달 전용] 컨텍스트 전달용 Map 설정
|
||||
* @see #transactionContextTransfer
|
||||
*/
|
||||
public void setTransactionContextTransfer(Map<String, Object> transactionContextTransfer) {
|
||||
this.transactionContextTransfer = transactionContextTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
EAIMessage cloned = (EAIMessage) super.clone();
|
||||
@@ -645,6 +684,8 @@ public class EAIMessage implements EAIMessageKeys, Serializable, Comparable<EAIM
|
||||
cloned.setStandardMessage((StandardMessage) standardMessage.clone());
|
||||
if (subMessage != null)
|
||||
cloned.setSubMessage((StandardMessage) subMessage.clone());
|
||||
if (transactionContextTransfer != null)
|
||||
cloned.setTransactionContextTransfer(new HashMap<>(transactionContextTransfer));
|
||||
return cloned;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.eactive.eai.common.session;
|
||||
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
@@ -58,6 +59,7 @@ public abstract class SessionManager implements Lifecycle {
|
||||
public static final String USERID_CAHCE_NAME = "convertUserIdSession";
|
||||
public static final String WEBSOCKER_CAHCE_NAME = "webSocketTimeout";
|
||||
public static final String TERMINAL_CAHCE_NAME = "terminalSession";
|
||||
public static final String CAGATEWAY_TOKEN_CACHE_NAME = "CAGatewayToken";
|
||||
|
||||
public static final String SESSION_MANAGER_GROUPNAME = "RMIInfo";
|
||||
public static final String SESSION_MANAGER_CACHETYPE = "cacheType";
|
||||
@@ -193,6 +195,14 @@ public abstract class SessionManager implements Lifecycle {
|
||||
public abstract void putLogin(String key, SessionVO value);
|
||||
|
||||
public abstract void removeLogin(String key);
|
||||
|
||||
//CA Token Cache
|
||||
public abstract BearerTokenInfo getCAToken(String key);
|
||||
|
||||
public abstract void putCAToken(String key, BearerTokenInfo value);
|
||||
|
||||
public abstract void removeCAToken(String key);
|
||||
|
||||
|
||||
// HTTP Cache
|
||||
public abstract SessionVO getHttpLogin(String key);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.eactive.eai.common.session;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.ehcache.CustomRMICacheReplicatorFactory;
|
||||
import com.eactive.eai.common.logger.EAIDBLogControl;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
@@ -921,4 +922,19 @@ public class SessionManagerForEhcache extends SessionManager {
|
||||
sb.append("</Caches>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BearerTokenInfo getCAToken(String key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putCAToken(String key, BearerTokenInfo value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCAToken(String key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMultic
|
||||
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
|
||||
|
||||
import com.eactive.eai.adapter.socket2.common.Env;
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.logger.EAIDBLogControl;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
@@ -63,6 +64,7 @@ import ch.qos.logback.classic.Level;
|
||||
// 에러내용 : Failed to execute the cache operation
|
||||
// (all partition owners have left the grid, partition data has been lost)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
public class SessionManagerForIgnite extends SessionManager {
|
||||
// evictMaster Instance - single socket 관련
|
||||
private static IgniteCache<String, String> evictMasterCache = null;
|
||||
@@ -72,7 +74,8 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
private static IgniteCache<String, EAIMessage> cacheTopic = null;
|
||||
// 비동기 거래 복원용
|
||||
private static IgniteCache<String, CacheStoreObject> cacheStore = null;
|
||||
|
||||
// CA Gateway Token 관리용
|
||||
private static IgniteCache<String, BearerTokenInfo> cacheCAToken = null;
|
||||
// webSocket Login cache 정보
|
||||
private static IgniteCache<String, SessionVO> cacheLogin = null; // key = loginId
|
||||
private static IgniteCache<String, String> cacheConvertUserId = null; // 단말ID 를 userID로 변경
|
||||
@@ -364,6 +367,7 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
caches.add(initCache(config, sessionTimeout, bootstrapAsynchronously, USERID_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, webSocketTimeout, bootstrapAsynchronously, WEBSOCKER_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, sessionTimeout, bootstrapAsynchronously, TERMINAL_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, 0, bootstrapAsynchronously, CAGATEWAY_TOKEN_CACHE_NAME, 1000, false));
|
||||
|
||||
config.setCacheConfiguration(caches.stream().toArray(CacheConfiguration[]::new));
|
||||
|
||||
@@ -391,6 +395,7 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
cacheSocket = manager.cache(ADAPTER_CAHCE_NAME);
|
||||
cacheTopic = manager.cache(TOPIC_CAHCE_NAME);
|
||||
cacheStore = manager.cache(STORE_CAHCE_NAME);
|
||||
cacheCAToken = manager.cache(CAGATEWAY_TOKEN_CACHE_NAME);
|
||||
|
||||
cacheLogin = manager.cache(LOGIN_CAHCE_NAME);
|
||||
httpLogin = manager.cache(HTTP_CAHCE_NAME);
|
||||
@@ -810,4 +815,33 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
sb.append("</Caches>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BearerTokenInfo getCAToken(String key) {
|
||||
try {
|
||||
return cacheCAToken.get(key);
|
||||
} catch (Exception e) {
|
||||
logger.error("getCAToken null key=" + key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putCAToken(String key, BearerTokenInfo value) {
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("Put CAToken key - " + key + ", CAToken - " + value.toString());
|
||||
}
|
||||
cacheCAToken.put(key, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCAToken(String key) {
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("Remove CAToken key - " + key);
|
||||
}
|
||||
cacheCAToken.remove(key);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user