Tomcat 7 multiplayer warfare using integrated ActiveMQ

I am working on a project in which I have several military files inside tomcat 7 that should communicate with one integrated activeMQ broker (5.5.1) inside the same Tomcat.

I am wondering what was the best practice to manage this and how to start and stop the broker properly.

In fact, I am trying to use the global JNDI entry in server.xml , and in every war my activemq connection is searched. The first connection to the broker implicitly starts it. But with this method, I encounter various problems, for example, already existing or locked in the data warehouse.

Should I use the extra war that BrokerFactory uses to run the broker explicitly? In this case, how to make sure that this war is carried out first in Tomcat? And how can I stop my broker and where?

Thanks for the help.

+4
source share
1 answer

from documents ...

If you use VM transport and want to explicitly configure the Embedded Broker, there is a chance that you can create JMS before the broker starts. ActiveMQ will now automatically create a broker if you are using VM transport and there is no one already configured. (In 5.2, you can use waitForStart and create = false to connect uri)

So, to get around this, if you use Spring, you can use attribute-dependent so that your JMS ConnectionFactory depends on the built-in broker to prevent this from happening. eg.

see these pages for more information ...

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
source

Source: https://habr.com/ru/post/1384267/


All Articles