Embed ActiveMQ into JBoss 7

2019-07-03 07:41发布

问题:

We used to use ActiveMQ 5.5 as an embedded service in JBoss 5 (via ActiveMQ Resource Adapter), so that the JMS broker has been always running on the localhost on the the same JVM as the client application itself. We followed this instructions to configure it - http://activemq.apache.org/integrating-apache-activemq-with-jboss.html

Now I'm trying to do the same for JBoss 7, but cannot find any clear guide how to do it.

Have anybody done this yet? Can you point me to the guideline with the concrete steps for integrating ActiveMQ into JBoss 7?

Thank you.

回答1:

I had to upgrade to ActiveMQ 5.6



回答2:

It is possible to launch the JMS broker inside the JVM of Wildfly so no need to set up a different ActiveMQ server.

All I did is just change the transport protocol inside standalone.xml

From :

tcp://localhost:61616?jms.rmIdFromConnectionId=true

To :

vm://localhost?broker.persistent=false

It is important to set the persistence to false as to avoid persistence configuration. In addtion, one can also set the ActiveMQ configuration file with the parameter brokerConfig=xbean:activemq.xml Monitoring the JMS queues

Now that the ActiveMQ console is down you probably wonder how can you check the queues. You can do it by connection to JMX environment of the Wildfly JVM.

You have two options :

-Use the ActiveMQ web console -Use JConsole

  1. Use the ActiveMQ web console

To enable the ActiveMQ console in Wildfly, just two steps are needed:

Set the JVM system parameters in standalone.xml to inform the ActiveMQ console application to connect through JMX. Add the following JVM system parameters under the extensions tag:

Deploy the ActiveMQ console war. This war contains the jboss-client.jar (under /lib).

The ActiveMQ should be running under this WildFly context

http://localhost:8080/activemq-web-console-5.11.1/

  1. Use JConsole

Just use JConsole by adding into its classpath the jar jboss-cli-client.jar. I have added bat file to run jconsole on Windows. Just set JAVA_HOME and JBOSS_JAR.

set JAVA_HOME=

set JBOSS_JAR=

%JAVA_HOME%\bin\jconsole -J-Djava.class.path=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\jconsole.jar;%JBOSS_JAR%\jboss-cli-client.jar"

On the new connection in JConsole, choose Remote process. Set value as :

service:jmx:http-remoting-jmx://localhost:9990

username : your_admin_username

password : your_admin_password

A few tabs will appear.

Go to MBeans tab, org.apache.activeMQ sub tree will appear on the left side.

For further reference, see :

http://javagoogleappspot.blogspot.be/2015/12/embed-your-activemq-broker-within-your.html