2 Replies Latest reply on Dec 10, 2001 5:32 AM by siocnarf

    MDB working as a singleton vs MBean

    siocnarf

      Hi all,

      I'm quite new to EJB's world and need an advise.

      I know that J2EE architecture is not thought to be able to manage singletons but in my current project, I will definitly have to cope with it.

      Somewhere in my stuff, I'll need a bean working as a sequencer e.g. something receiving messages and able to forward them in the right order.

      what should I do ?

      1° write an MDB, limit pool size to 1 and make sure to manage its persistence (by using NonSerializableFactory or DB storage for instance)
      2° write an MBean listening to the queues and in that case, will I be sure that only ONE instance of my MBean will be running in the same time ?
      3° as JMS destinations are still accessible outside of the server VM, should I use a standalone CORBA server just for the sorting stuff ?

      Would someone be kind enough to remind me the assets of using MBeans apart from their being manageable ?


      Many thanks for your help.

        • 1. Re: MDB working as a singleton vs MBean

          Hi, I have to admit that I am not shure what you are after, but I know this much:

          1. An MDB with a pool size set to one, and listening on a queue should receive its messages in the order they where sent.

          2. To create a singleton you could use a singleton deployment descriptor for a session bean, to get only one active instance (JBoss specific - look into the manual).

          //Peter

          • 2. Re: MDB working as a singleton vs MBean
            siocnarf

            Hi Peter,

            Thanks for your answer.

            Actually, my question was only about the different means to create singleton beans. :-)

            I think I'd probably write the MDB.