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?
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.
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.