This commit is contained in:
zoomk
2025-10-28 16:21:29 +09:00
parent fc6f490399
commit d4243f940a
2 changed files with 5 additions and 37 deletions
@@ -79,7 +79,7 @@ public class TimerEventListenerQueueConsumerService implements InitializingBean
es = Executors.newFixedThreadPool(maxThread); es = Executors.newFixedThreadPool(maxThread);
ServiceLocator locator = ServiceLocator.getInstance(); ServiceLocator locator = ServiceLocator.getInstance();
logger.debug("TimerEventListenerQueueConsumerService startConsumer [ uri=" + uri +"]");
QueueConnectionFactory connectionFactory = locator.getQueueConnectionFactory(uri); QueueConnectionFactory connectionFactory = locator.getQueueConnectionFactory(uri);
connection = connectionFactory.createQueueConnection(); connection = connectionFactory.createQueueConnection();
@@ -188,23 +188,17 @@ public class ServiceLocator {
public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName) public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName)
throws ServiceLocatorException { throws ServiceLocatorException {
QueueConnectionFactory factory = null; QueueConnectionFactory factory = null;
System.out.println("=================getQueueConnectionFactory qConnFactoryName["+qConnFactoryName+"]");
try { try {
if (cache.containsKey(qConnFactoryName)) { if (cache.containsKey(qConnFactoryName)) {
factory = (QueueConnectionFactory) cache.get(qConnFactoryName); factory = (QueueConnectionFactory) cache.get(qConnFactoryName);
} else { } else {
factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName); factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName);
cache.put(qConnFactoryName, factory); cache.put(qConnFactoryName, factory);
// System.out.println("=================getQueueConnectionFactory not containsKey");
// factory = getRemoteQueueConnectionFactory(
// "t3://192.168.240.176:8003", // 또는 실제 서버 주소
// qConnFactoryName
// );
} }
// } catch (NamingException ne) { } catch (NamingException ne) {
// //throw new ServiceLocatorException(ne); //throw new ServiceLocatorException(ne);
// throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne,"RECEAICUL113")); throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne,"RECEAICUL113"));
} catch (Exception e) { } catch (Exception e) {
//throw new ServiceLocatorException(e); //throw new ServiceLocatorException(e);
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e,"RECEAICUL114")); throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e,"RECEAICUL114"));
@@ -212,32 +206,6 @@ System.out.println("=================getQueueConnectionFactory qConnFactoryName[
return factory; return factory;
} }
public QueueConnectionFactory getRemoteQueueConnectionFactory(String providerUrl, String jmsFactoryJndiName)
throws ServiceLocatorException {
QueueConnectionFactory factory = null;
try {
if (cache.containsKey(jmsFactoryJndiName)) {
factory = (QueueConnectionFactory) cache.get(jmsFactoryJndiName);
} else {
Hashtable<String, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, WEBLOGIC_INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, providerUrl); // ex: "t3://localhost:7001"
Context ctx = new InitialContext(env);
factory = (QueueConnectionFactory) ctx.lookup(jmsFactoryJndiName);
cache.put(jmsFactoryJndiName, factory);
}
return factory;
} catch (NamingException ne) {
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL113"));
} catch (Exception e) {
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL114"));
}
}
/** /**
* 1. 기능 : Queue를 반환하는 method * 1. 기능 : Queue를 반환하는 method