• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running a process in background (in separate thread)

 
B Nirvan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a simple situation wherein the user wants to send emails to multiple recipients (that will be looked up from database). The number of recipients is going to be considerable, which means that the whole process will take some time to complete.

Given this scenario, I think the best way to run the "send email" process, would be to run it in a separate thread. Since the J2EE prohibits/discourages creating new threads, I think I will have to use EJB's (either stateless bean marked as @asynchronous, or MessageDriven Bean).

If I am correct in what I said above, which is possibly the best choice for the "send mail" process, asynchronous Stateless Bean or MDB? Also, if I use either of these, how should I notify the user when the process successfully completes or fails.

Another crude thing that came in my mind was to open a new window for the "send mail" option and process the same in that window. But I am not sure about whether, the JSF (or JEE) specs describe the behaviour of one user, multiple windows request processing.

To summarise my doubts,
1. Whether to use EJB or simply create new window and process the "send mail process" in that window.
2. If use of EJB is mandated, whether to use SLSB or MDB
3. If EJB is used, how to notify user of the process success/failure.

regards,
Nirvan.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic