Open Development Platform

Eclipse Platform

Subscribe to Eclipse Platform: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Eclipse Platform: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Eclipse Platform Authors: Janakiram MSV, Ken Fogel, Marcin Warpechowski, Michael Meiner, Liz McMillan

Related Topics: JBoss Enterprise Middleware, Intel XML, XML Magazine, Eclipse Platform, Java Developer Magazine

Blog Feed Post

JMS 2.0 remote client for embedded HornetQ in Wildfly 8

While testing the new JMS 2.0 API, I wanted to see an example of the remote client connecting to a messaging server. I decided to start with the HornetQ messaging server that’s embedded into JBoss Wildfly 8. Folks from JBoss sent me a link to the the GitHub project Wildfly/Quickstart with lots of Wildfly Java EE 7 examples. The HelloWorldJMSClient was the one I was looking for.

The readme file contains detailed instructions on how to compile and run the example. Seeing a requirement to have Maven 3.1 or better looks like an overkill for a helloworld type example. Installed Maven using homebrew – it gave me Maven 3.0.5. Does it mean that helloworld wouldn’t work? Yes it does, but not because of the old maven version. The pom.xml has references to old versions of Wildfly.

In two days I’ll be teaching a JMS class online. Sending students to the maven maze is not appealing to me. Here’s what I suggest. Follow the instructions from the Readme.md to start the Wildfly server, create a user, and a queue. But then, compile and run HelloWorldJMSClient by simply adding jboss-client.jar to the classpath – it has all required JNDI and JMS classes. For example, this is how you can do it from a Terminal window (or a Command Window):

java -cp “.:/Users/yfain11/wildfly-8.0.0.Final/bin/client/jboss-client.jar” org.jboss.as.quickstarts.jms.HelloWorldJMSClient

That’s all. Look ma, no Maven! I sent a GitHub pull request to the Wildfly folks to add this solution to their readme file.

If you like working in IntelliJ IDEA IDE, just add the jboss-client.jar as an external library to your module. If you are an Eclipse fan, go to Project Properties | Build Path and add the jboss-client.jar as an external jar.

A bit later I’m planning to do the same test against GlassFish/OpenMQ combo. I know that in the past they were suggesting using appclient for these purposes, but there should be a simpler way to do stuff.


Read the original blog entry...

More Stories By Yakov Fain

Yakov Fain is a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay. He wrote a thousand blogs (http://yakovfain.com) and several books about software development. Yakov authored and co-authored such books as "Angular 2 Development with TypeScript", "Java 24-Hour Trainer", and "Enterprise Web Development". His Twitter tag is @yfain