Here is the next post in the series. Java to Java over QMF. Granted, this is a pretty dumb way to actually connect to an EJB.. since Java provides many ways to do it natively. But, it does show a different console technology accessing the same backend. As before, you can read up on QMF and then build these examples. I will republish the directions from the earlier post to limit the number of times you need to scroll down.

To get started, you will need the gcc tools, ant, and jboss5 installed. Next.. get the code:


# Get the latest QPID Code
svn co http://svn.apache.org/repos/asf/qpid/trunk
# Get my example Code:
git clone git://github.com/bkearney/qmfExample.git

Build the latest qpidd broker and java code


cd trunk/qpid/cpp
./bootstrap
./configure --prefix ~/qpidlocal
make install
cp ../java
ant

Once this is done, you should be able to launch the most current qpidd


export LD_LIBRARY_PATH=~/qpidlocal/lib
~/qpidlocal/sbin/qpidd

Now…. build the java agent which has the EJB we are going to expose


cd ~/qmfExample/javaAgent
# Edit the build.properties file to point to your local
# installation
ant install

Now that we have that… we will build the Java Console to talk to the agent. As with the C# console earlier, the Java example code has 2 versions. One is using the raw QMF Session interface, and is the most similar to the python code. This is located in the qmfExample/javaConsole/generic directory. The second has some classes which were generated off of the example schema. This code is located in qmfExample/javaConsole/generated. The same logic can be used to generate either one.


cd qmfExample/javaConsole/generic
# edit your build.properties and set the property qpid.home and jboss.home
ant build
ant run

VIOLA! You see the EJB being accessed, and the schema being created. This is the third technology to access the example… next week.. ruby.