[英]Spring 3 JMS on Tomcat
Is it possible to implement JMS messaging in tomcat? 是否可以在tomcat中实现JMS消息传递? I have a spring mvc application and I need to implement JMS messaging.
我有一个spring mvc应用程序,需要实现JMS消息传递。
I can not use glassfish. 我不能用玻璃鱼。 I know its very easy to do JMS messaging with message driven bean but on application server.
我知道使用消息驱动bean进行JMS消息传递非常容易,但是在应用程序服务器上。
So if there is a possibility, can someone provide some examples how to create a JMS connection factory and queue for spring application? 因此,如果有可能,是否有人可以提供一些示例,说明如何创建JMS连接工厂并排队供Spring应用程序使用?
I have a JMS queue sender class: 我有一个JMS队列发送者类:
public class JmsQueueSender {
private JmsTemplate jmsTemplate;
private Queue queue;
public void setConnectionFactory(ConnectionFactory cf) { //?????????????????????
this.jmsTemplate = new JmsTemplate(cf);
}
public void setQueue(Queue queue) { //?????????????????????
this.queue = queue;
}
public void sendMessage(final Serializable object) {
jmsTemplate.send(this.queue, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createObjectMessage(object);
}
});
}
}
The main question is how to create a connection factory and queue, what objects to use. 主要问题是如何创建连接工厂和队列,使用哪些对象。 In glassfish I have been creating a JMS resource through application server admin console.
在glassfish中,我一直在通过应用程序服务器管理控制台创建JMS资源。 How can I do this in spring application which runs in tomcat?
我如何在tomcat中运行的spring应用程序中执行此操作?
Yes, it's possible. 是的,有可能。 Have you looked at the JMS chapter of the Spring manual?
您是否看过Spring手册的JMS章节 ?
You could also look at Apache TomEE Plus which is Tomcat + JMS and more. 您还可以查看Apache TomEE Plus ,它是Tomcat + JMS等。 You can either drop that into Tomcat via the war distro or get the pre-bundled version.
您可以通过战争发行版将其放入Tomcat,也可以获取预捆绑的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.