8 Replies Latest reply on Jan 3, 2007 4:54 AM by oglueck

    JBoss Shutdown and long-running MDB

    Patrick Wright Newbie


      Using JBoss 4.0.2 (Sun or JRockit JVM) on Windows XP.

      I have an MDB that in some cases takes a number of minutes to process its message. There can be a number of these working on messages concurrently. In development, I have logging during processing so I can see % complete.

      I just found out that if I try to either redeploy my EAR, or if I try to shutdown JBoss on the console (CTRL-C), any of these MDBs that are running will continue running until they complete--and the shutdown process will simply wait for them. No call to ejbRemove() is made, and there don't seem to be any other callbacks I can register.

      I've only see one posting on this forum related to this, and there was one proposal--using a sort of Singleton in a separate queue to act as a semaphore if the server was shutting down. Doesn't sound like a very clean (or reliable) solution.

      Any ideas on the correct way to trap a server shutdown and stop my MDB processing cleanly? The message can stay in the queue, it can be retried later--the issue is just that I can't stop this long-running processing.