Integrating existing tomcat server with Active MQ?

吃可爱长大的小学妹 提交于 2019-12-10 21:22:09

问题


I am using tomcat as webserver. Planning to use active mq for messaging purpose. Just started learning about jms and activeMQ. Gone thru https://activemq.apache.org/getting-started.html. What i have got is active mq comes with its own web server(probably apache IS not sure). My question is what if I want to use existing tomcat server instead of installing new server for active mq. Is it possible?

UPDATE: i think i can itegrate existing tomcat with https://activemq.apache.org/tomcat.html


回答1:


Yes Apache ActiveMQ is a light-weight broker, so you can deploy it in Apache Tomcat as a WAR file. Or try Apache TomEE which comes out of the box with AcitveMQ.

http://tomee.apache.org/apache-tomee.html

If you deploy ActiveMQ as a WAR file then it does not come with its own web service, its only the standalone distribution of ActiveMQ that comes with Jetty as its web server. You just don't need to include Jetty in your WAR file with ActiveMQ embedded.

At Apache Camel we have an example of a WAR file with ActiveMQ and Camel as a WAR file you can deploy in Tomcat. You can take a look, and just remove Camel from the example:

http://camel.apache.org/activemq-camel-tomcat.html




回答2:


See these:

http://blog.octera.info/2011/06/how-to-embed-activemq-in-tomcat/

http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html

Basically, you just start a broker in your web application. If you need to retrieve some resource like ConnectionFactory or Destination(Queue/Topic), you can use Tomcat JNDI support to do this.



来源:https://stackoverflow.com/questions/22890247/integrating-existing-tomcat-server-with-active-mq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!