QMF # 3: Java to Java over QMF

Posted: June 26, 2009 in geek stuff

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
./configure --prefix ~/qpidlocal
make install
cp ../java

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

export LD_LIBRARY_PATH=~/qpidlocal/lib

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.

  1. […] languages to connect to EJBs running in a JBoss 5 container. There hass been python, C#, and Java. Now, lets add ruby to the list. Steps for building and deploy the Java agent can be found in the […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s