permaculture playing cards*
The moose likes Spring and the fly likes Spring JMS vs MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring JMS vs MDB" Watch "Spring JMS vs MDB" New topic
Author

Spring JMS vs MDB

Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
Hi

Can anyone please suggest on how we can compare Spring JMS with EJB3 MDB. I mean which one is better? I want to implement JMS with features like load balancing, multithreading etc. and am confused over which open source software to go with.
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi Dorothy,

as far as I know, I'd say one big difference is that EJB is a standard and Spring is not. Moreover I remember that the EJB specification allows another messaging service besides JMS for MDBs although I don't know what alternatives exist in practice. Because I don't know more details about Spring JMS, I unfortunately can't tell you more differences but perhaps this helps a little bit.

I want to implement JMS with features like load balancing, multithreading etc. and am confused over which open source software to go with.

What does this mean? Do you really want to implement a JMS provider or something like that by yourself? Or is it that you want to know which open source implementations you can use?

Marco
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
If you mean Spring's MDP support vs MDB. The main difference is if your MDP will be called by multiple threads you have to make your MDP implementation thread-safe.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
Well, in order to make it thread-safe, i guess we can use the DMServer and maybe also to take care of clustering and things like that. But what I am trying to know is that is Spring MDP better than EJB MDB or not? My application is a multithreaded application. In this app, there are many processes that asynchronously communicate with each other by placing messages in queues
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Dorothy Taylor wrote:Well, in order to make it thread-safe, i guess we can use the DMServer and maybe also to take care of clustering and things like that.

I don't know how using DM Server or clustering would make any object thread-safe. You need to handle it yourself.

Dorothy Taylor wrote:
But what I am trying to know is that is Spring MDP better than EJB MDB or not?

MDP is an alternative of MDB, so you can make something like MDB without using EJB container.
Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
I guess I'll provide a few details on my requirement. I have an aplication that runs on a single machine and there are various processes. Each process is taking input from a queue and placing the output in another queue for the next application to process. So one process's output(into an IBM MQ) is another process's input. All these processes are currently in a single machine, they are multithreaded and the performance is okay with the current load, but if we will increase the load, the performance may not be so good. So I am looking out for options such that:

  • The cost is minimal i.e. if IBM MQ could be replaced with open source alternative
  • Multithreading, failover, load balancing etc. can be accomplished with ease


  • So one option is that Spring JMS can be a choice for doing JMS and JBoss MQ may be the queuing solution. Now the question is that how can we compare EJB MDB's and Spring MDP's. Also since there is no front end can we use Spring DMServer for all the things like clustering etc.

    thanks
    Hong Anderson
    Ranch Hand

    Joined: Jul 05, 2005
    Posts: 1936
    Multi-thread could lead to thread-safe issue. If you use EJB you don't have to worry because all enterprise beans are thread-safe.
    But if you use Spring's MDP support, you have to make your MDP implementation thread-safe, if the MDP can be called by multiple threads.
    Dorothy Taylor
    Ranch Hand

    Joined: Nov 26, 2007
    Posts: 104
    Will the server on which the MDP is deployed, not take care of making the app thread safe?
    Hong Anderson
    Ranch Hand

    Joined: Jul 05, 2005
    Posts: 1936
    Dorothy Taylor wrote:Will the server on which the MDP is deployed, not take care of making the app thread safe?

    No.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Spring JMS vs MDB
     
    Similar Threads
    MDB question
    MDB listening to topics
    MDB + Entity Bean / MDB + SB + EB
    What is the relationship between JMS and MDB?
    MDB + JMS : handling an incoming MQmessage