3 Replies Latest reply on Dec 12, 2003 7:49 PM by paulmoore100

    MBeans vs. EJB's

    lekkim

      Hi,

      I have been developing applications on JBoss for some time now and have really taken a liking to MBeans as a way to build server side components. Many of the applications I have been involved in hasn't been web applications per say but more general applications where we needed a server to host some common components.

      There is one question though that I have been unable to find information on anywhere and that is when it is ok to use MBeans for server side components. Is it just a matter of taste or are there more issues to consider ?

      When I try to think about it I see the following issues in web applications that might weigh in favor of EJB's:
      * portability / standard-based (across containers)
      * security (automatically applied to EJB's)
      * transaction support (automatically applied to EJB's)
      * pooling (I see no way to scale applications built in MBeans)
      * transparency (network / location)

      The question is really if some of you guys have any experiences you would like to share in regard to when you use MBeans and when you use EJB's. Is there any special components you normally implement as MBeans and some in EJB's ?

      Any insight would be appreciated...

      lekkim

        • 1. Re: MBeans vs. EJB's

          Everything except portablity can be resolved using
          XMBeans and interceptors or other approaches.

          Portability is the biggest issue.

          Regards,
          Adrian

          • 2.
            andrewboyd

            Adrian,
            I'm going to need to pool my XMBeans. I figure when I deploy them I'll
            need some counter attribute so they won't have the same ObjectNames.
            However will I have to write my own Dispatcher type class so as to distribute the workload or is their something already in JBoss that I can use?

            Thanks,

            Andrew

            • 3. Re: MBeans vs. EJB's
              paulmoore100

              They are aimed at differernt things.
              EJBs are for building amazon.com, ie fast, high volume, transactional processing.
              MBEans are for building systems. JBoss EJB container is made out of MBeans.
              In order to do guarantee EJB performance there are major limits placed on them such as no threads (killer). The main difference is that an EJB is not alive unless somebody is talking to it.
              The downside is that you have to roll a lot of your own stuff in the MBEan world - but then thats why you are using them - you have the choice to make them do whatever you want
              JMX Mbeans are just as much a standard as EJB are. If you avoid the obscure corners of the JBoss implementation then you stuff should work in most JMX containers. In real life EJBs are not very portable either