Long-running processes and client context propagation to JMS


EJB design: Long-running processes and client context propagation to JMS

  1. We have some long-running procedures that we have isolated from the application server into a seperate process to avoid trx timeouts in our session beans. We initiate this procedures with JMS from the client. A message is sent back to the client on completion.

    This way we could lower the load from our application server and long-running tasks are executed one after one by this seperated process.

    Now for some tasks we need the client context. The problem is that JMS messages are anonymous. Any suggestions how we can propagate the client security context and run this long task as run by he client?


  2. Well, you're getting the client context parameters in the first place, right? Just send them with the message, as part of it or as "header" properties. In your receiving process, simply extract them and use them to reconstruct the Context instead of anything hard-coded or the "default" InitialContext.
  3. That's one solution, but isn't it a security issue to send username and password in the jms message? Perhaps if all communication goes over a secure channel this could work.