[英]Is it possible to implement JMS, Spring and Tibco EMS on a standalone Java app?
所以这是我的问题!
我有一个带有身份验证的Tibco EMS主题
我有一个独立的应用程序,我想发布并使用此消息
我想通过Springs JMSTemplate,Listener等来做到这一点。
前听众:
public class ExampleListener implements MessageListener {
public void onMessage(Message message) {
if (message instanceof TextMessage) {
try {
//TODO DAO interface to write to db
System.out.println(((TextMessage) message).getText());
} catch (JMSException e) {
throw new RuntimeException(e);
}
} else {
throw new IllegalArgumentException(
"Message must be of type TestMessage");
}
}
}
样本发布者:
import org.springframework.jms.core.JmsTemplate;
public class ExampleProducer {
私人JmsTemplate jmsTemplate;
public ExampleProducer(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void sendMessage() {
jmsTemplate.convertAndSend("Example Message");
}
}
and here's some of the properties:
jms.jndi.initialContextFactory = com.tibco.tibjms.naming.TibjmsInitialContextFactory jms.jndi.urlPkgs = com.tibco.tibjms.naming
jms.jndi.providerUrl = tibjmsnaming:/ * *** .net: ***
这可能吗?
谢谢
是。 这是一个相当典型的设置。
您只需要一些额外的配置来补偿您不在Java EE环境中运行的事实。 因此,您没有通过资源引用进行简单的JNDI查找。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.