I've got a relatively straightforward problem, I've got a portlet where a user can put in a date range and some other information which I then use to generate some reports which I want to email to them once they are complete. These reports can take quite some time to finish (30 minutes plus), so I thought it would make sense to spawn a thread that would go begin generating the reports and would email it to them once it is finished while the portlet would just quickly tell them "Thanks, we'll email you your report shortly!" or something like that.
Anyway, I know I don't just want to spawn my own threads inside JBoss AS as then the container won't be aware of them, but Google didn't really present me with what exactly the best way to handle threading is inside JBoss AS 7.1.1. I found talks about JSR 237, JSR 236, and JCA WorkManagers, but nothing that really said, "Here's how you should do this."
Fwiw, I don't imagine that there will be more than 1 or 2 requests per hour for this report by users so I don't want to over-engineer this problem if it's not necessary. I just want to know what the best way to handle something like this is, as I'm guessing spawning my own thread in the portlet or just writing a shell script and calling it from inside the portlet with Runtime.exec() is not the way to go
Thanks in advance for your help with this problem.
I think just using a message driven bean makes the most sense for this. I was just wondering if there was a simpler solution to just spawn a thread, but this seems to meet my needs.