activemq之使用共享嵌入式 ActiveMQ 在 Tomcat 7 中进行多次 war
我正在开发一个项目,我在 tomcat 7 中有几个 war 文件必须与同一个 Tomcat 中的单个嵌入式 activeMQ (5.5.1) 代理进行通信。
我想知道管理这个的最佳实践是什么,以及如何正确启动和停止代理。
实际上我尝试在 server.xml
中使用全局 JNDI 条目并在每次 war 中通过查找获取我的 activemq 连接。到代理的第一个连接隐式启动它。但是使用这种方法,我遇到了各种问题,例如实例已经存在或数据存储中的锁定。
我应该使用一个额外的 war ,它使用 BrokerFactory 显式启动代理吗?在这种情况下,如何确保这场 war 首先在 Tomcat 中执行?我如何停止我的经纪人以及在哪里?
谢谢您的帮助。
请您参考如下方法:
从文档...
If you are using the VM transport and wish to explicitly configure an Embedded Broker there is a chance that you could create the JMS connections first before the broker starts up. Currently ActiveMQ will auto-create a broker if you use the VM transport and there is not one already configured. (In 5.2 it is possible to use the waitForStart and create=false options for the connection uri)
So to work around this if you are using Spring you may wish to use the depends-on attribute so that your JMS ConnectionFactory depends on the embedded broker to avoid this happening. e.g.
请参阅这些页面了解更多信息...
http://activemq.apache.org/vm-transport-reference.html
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
http://activemq.apache.org/how-do-i-restart-embedded-broker.html
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。