JMS Application Design

Posted on 2011-10-04
Last Modified: 2012-05-12
Hi All,

I am currently designing a JMS application and I have a few questions....

At the following URL .....

I found information telling me that there are two different ways to configure a JMS application.

1. Use triggers function of WebSphere MQ
2. Deploy a Message-Driven Bean to WebSphere App Server connected to the MQ

Most of our existing applications use method 2. However I have been asked to investigate method 1 and to find out how commonly used it is. Can anyone provide me some advice on how hard it is to use this and whether it is standard practice?

Also If I do with option 2. I have been asked to look into architecting the application using a multi-threaded / load balancing architecture. For example. Is it possible to get two instances of the message driven bean listenting for messages  on the same queue? In that way if one of the listeners dies because of unforseen circumstances then at least the other instance will remain alive processing messages.

I'm not sure about this last question. I would think it would be possible but then how do the two applications know how to share to load?

Question by:au_richierich
    1 Comment
    LVL 19

    Accepted Solution

    Hi. I've used MQ triggers in previous applications. It isn't extraordinarily difficult. We were using MQ on Windows servers. As I recall one of the biggest issues was always correct configuration of the process definition to be sure that it spawned a detached process otherwise it would block the initiation queue until the spawned process completed. Another concern is that, assuming you're writing your triggered processes in Java, each will spin up another JVM instance. This isn't really very efficient if you have a significant number of queues. On Windows the triggering mechanism didn't seem to be very reliable. I'll admit this was 7-8 years ago so I can't speak to the improvements IBM may have made in WMQ since then. In the end, since we were also a WAS shop, we started converting all our triggered processes to MDBs. One advantage of this was that we got XA-transactions for free using MDBs which you wouldn't using triggered processes. An alternative now might be to use an ESB like Mule to handle all the MQ processing.

    As for a distributed multi-threaded load-balanced design, yes it is possible to have multiple instance of an MDB and multiple application servers with a deployed MDB that are all listening on the same queue. WMQ knows to deliver the message to just one instance with BMT or CMT determining if the read is committed or not. The "load-balancing" is really a function of message delivery rate and how busy the application server is. The MDB threads compete with all the other server activities for resources. Say you have your application deployed on two app servers running on different hosts. Each app server will have multiple instances of the MDB that can be handling messages in parallel, say 5 instances per server. The MDB needs a finite amount of time to process a message, let's call it 1 second. That means each server will be handling messages at the rate of 5 per second. If server A gets very busy because of some other activity and now it takes 2 seconds per message while server B is still processing at 1 second per message then server B will consume more of the load than server A.


    Jim Cakalic

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now