1 Reply Latest reply on Dec 4, 2005 10:14 PM by gavin.king

    EJB3 design pattern: job queueing

    patrick_ibg

      What's the best way to implement the EJB3 equivalent of a non-blocking function to execute long-running jobs requested by multiple clients? (Normally for J2SE one could use a singleton object that implements Runnable.)

      I know JBoss has extensions that allow a client to make asynchronous calls to session beans, and also service beans that guarantee singleton behavior. I can work out a solution with these two features. However, I'd like to know if there is a way to do this without using vendor extensions...

      I've also looked at MDBs, but they seem like an odd fit for what I need. First, I have no need to serialize the request parameters--all parameters can be passed by reference, and they do not have to persist between JVM restarts. Second, I haven't figured out how to guarantee that an MDB is singleton via annotations.

        • 1. Re: EJB3 design pattern: job queueing
          gavin.king

          The only way to do this portably is using an MDB. JBoss has argued in the EJB EG that there should be a better way to do this, along the lines of our @Asynchronous extension. However, there was insufficent time and consensus to get this addressed in EJB 3.0. I very much hope that EJB 3.1 will provide this kind of functionality.