• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending Mails with JSF  RSS feed

 
Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am thinking of the best strategy for stable mail sending in my web application.

I would like to run it on a separate thread, in order to kindof "order" a report and inmediately after be able to work with the app, so that this separate thread sends it to its destination once the thread is done with it (after that the thread would be diposed). The point is that as far as I have seen, creating a new Thread inside the JSF main thread, will prevent JSF's main thread from starting the lifecycle, therefore working with the application while the mail is being cooked is by now impossible.

Can anybody give some hints?
Should I run a separate java process?, or is there a way to run a brand new Thread totally independent from JSF's main thread?

Thanks for your suggestions!

Carlos.
 
Paul Clapham
Sheriff
Posts: 22378
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see why you need to have a separate thread to send an e-mail. (You were referring to e-mail, right?) Sending e-mail isn't a very time-consuming process at all.
 
Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thanks for your answer. The point is that the mail will contain a pdf report which takes time to produce, then there are cases where it involves assembling other smaller reports and images.

So that's why.

I have read of a scheduler application called
Quartz
, which would enable me to produce those reports and send the e-mail through another java process, and some how manage the periodicity for the e-mail sending and production. From my perspective I think that should be the most reliable solution if I want to avoid server crashes or unpredictable results, then some reports containt about 30 pages and there's no specific control over image resolution. That could lead me to performance problems in the future. Through a sepparate process I could someway discard those executions which were too time consuming, without interfering at all with JSF's lifecycle.

What do you think?

Many thanks in advance,

Carlos.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!