Java Reference
In-Depth Information
After executing this command script, you now have everything running for your
test application. In order to see things work, you need to publish control mes-
sages to the message bus. The next section describes the process of running the
JMSPublisher class that you built to publish control messages.
13.4.4
Publishing the control messages
Your publisher class will publish three messages to the message bus. The first two
messages drive your MBean functionality, and the third message causes your
MBean to print a message to the screen indicating that it is not interested in the
message. Listing 13.8 shows the command script required to run the publisher.
Again, notice the reference to the JMS JAR s from the JBoss provider.
Listing 13.8
runPublisher.bat
@echo OFF
REM JMSPublisher class
set CLIENT_CLASS_DIR=c:\JMXbook\build
REM Directory where jndi.properties is located
set JNDI_RESOURCE_DIR=resources
set JBOSS_DIST=d:\JBoss-2.4.4
REM Required libs to run client
set CLASSPATH=%JBOSS_DIST%\client\jbossmq-
client.jar;%JBOSS_DIST%\client\jnp-client.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\client\jta-
spec1_0_1.jar;%JBOSS_DIST%\client\jboss-j2ee.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\lib\ext\oswego-
concurrent.jar;%JBOSS_DIST%\client\log4j.jar
REM Aggregated classpath
set CLASSPATH=%CLASSPATH%;%CLIENT_CLASS_DIR%;%JNDI_RESOURCE_DIR%
echo "Running with classpath %CLASSPATH%"
%JAVA_HOME%\bin\java -classpath %CLASSPATH%
jmxbook.ch13.JMSPublisher
Congratulations—you just successfully integrated JMX with JMS .
13.5 Summary
This chapter presented the idea of integrating JMX MBeans into your Java Mes-
sage Service applications. Due to the non-intrusive nature of JMX , you can build
a window into your JMS applications using JMX MBeans. By writing MBeans that
Search WWH ::




Custom Search