Friday, March 16, 2007

Open ESB & GlassFish: JMS messaging (part 1)

In my last post Open ESB & GlassFish: Getting Started I provided information on our SOA Lab as well as history behind why we selected Open ESB & GlassFish to test in the lab. This post I describe my experience with trying to implement the first step in our use case, JMS messaging between a Alert System running in a Geronimo application server and a BPEL process running in GlassFish.

My goal is to build a BPEL process that can send and receive JMS messages with the Alert System running in a separate and different application server. Sounds pretty straight forward and nothing new for even the "greenest" of SOA products. However, there one little detail that doesn't make this so simple...the message queue implementation is ActiveMQ running in Geronimo.

So I figured I'd first "ease" my pain with this implementation by walking through a tutorial "Step by Step toward a jms sample in NetBeans and yes GlassFish" on Masoud Kalali's Blog...and to no one's surprise, it worked. In all fairness, it turned out to be a good and informational tutorial. Masoud's approach was to:
  1. Configure the internal GlassFish JMS implementation
  2. Develop a Message-Driven Bean (MDB) to pop messages off a queue
  3. Develop a web-based JMS client application that would put messages on a queue
The sample was quite simple and easy to build, deploy and test. However, remember my first blog post (Let the Journey Begin), I mentioned that "...we are not satisfied with just stepping through scripted tutorials of basic examples that the SOA product vendors offer." This is a good example. Masoud's sample works very nicely however, it's using GlassFish JMS implementation, the MDB is deployed in the same GlassFish application server and the web-based JMS client application is (yet again) deployed in the same GlassFish application server.

Ok, at this point I feel I'm ready to implement the first step in the use case. I have the VE (Virtual Enterprise) running in a Geronimo application server that uses ActiveMQ. The Alert System running in Geronimo is placing messages on an ActiveMQ queue. After doing some research and talking with my colleague Steve Smith (who is working with CapeClear on implementing the same use case), I came up with the following approach:
  1. Configure a ActiveMQ resource adapter in GlassFish. I referenced the steps in the Sun Java System Application Server docs for Foreign JMS Providers
  2. Change the MDB annotations to map to the remote ActiveMQ queue
  3. Test with the Alert System running in Geronimo
Well I was able to successfully configure the ActiveMQ resource adapter in GlassFish. The MDB deployed just fine with the changes to the annotations to map to the remote ActiveMQ queue however, messages are not being pop off the ActiveMQ queue. Interestingly enough, I can use the web-based JMS client deployed in GlassFish to put messages on the remote ActiveMQ through the resource adapter in GlassFish. So, I believe the resource adapter is configured properly but my MDB is still having "issues."

I'm real close but not there yet. To top it off, I've had to temporarily "shelf" the Open ESB & GlassFish project and focus on Sun Java CAPS. We were fortunate enough to get some Sun training on Java CAPS and we've decided to implement the use case in the SOA lab since Java CAPS is still fresh in our minds. As much as I hate to leave a problem unresolved, I have to in this case but I WILL come back to it.

...my next post will be on the Sun Java CAPS SOA product tools in our lab.

5 comments:

Anonymous said...

Hi there,

I'd like to know more about the foreign jms providers but the link provided in your article wasn't really helpful. I thought that it'll point to some ressources how to use activemq as a foreign provider for glassfish but that's not.
Do you have some documentation or examples for that?

me

Rod Biresch said...

The link for "Foreign JMS Providers" in the post was wrong. I've fixed it and it now points to (http://docs.sun.com/app/docs/doc/819-3658/6n5s5nkls?a=view). What I originally tried was using ActiveMQ's resource adapter deployed in GlassFish but didn't get too far. Since then I've change my approach (see part 2). Here's another link that maybe useful (http://activemq.apache.org/resource-adapter.html).

Rod

Unknown said...
This comment has been removed by a blog administrator.
Anonymous said...

Oracle is not being a good steward of Glassfish. If you want an open source ESB and open source Application Server, check out what WSO2 offers

http://wso2.com/products/application-server/

http://wso2.com/products/enterprise-service-bus/

IsuruH said...

Interesting article. But, why not use a completely open source ESB and an Application Server? Check out wso2 open source ESB and App Server. See some relevant articles http://wso2.com/library/knowledge-base/2011/03/communicating-wso2-app-server-jms/, http://docs.wso2.org/display/ESB481/JMS+Usecases