title: How to launch a long running Java EE job?
body: <p>I need to fire off a long running batch type job, and by long we are talking about a job that can take a couple of hours. The ejb that has the logic to run this long running job will communicate to a NoSQL store and load data etc.</p>
  
  <p>So, I am using JMS MDBs to do this asynchronously. However, as each job can potentially take up to an hour or more (lets assume 4 hours max), I dont want the onMessage() method in the MDB to be waiting for so long. So I was thinking of firing off an asynchronous ejb within the onMessage() MDB method so that the MDB can be returned to the pool right after the call to the batch ejb runner.</p>
  
  <p>Does it make sense to combine an asynchrous ejb method call withing an MDB? Most samples suggest using 1 or the other to achieve the same thing.</p>
  
  <p>If the ejb to be invoked from the MDB is not asynchrous then the MDB will be waiting for potentially long time. </p>
  
  <p>Please advise.</p>