Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Mail Sending Queue

843830Jan 7 2005 — edited Feb 9 2005
What would be the best way to create a queue for outoing SMTP messages? Or does one already exist?

Here's my problem, I've developed an app with email-capable notices, error messges, and reminders. It can deliver an email an hour or up to 100 in a minute depending on what's happening. I originally started with a method I'd created to send the email via Transport(send) to my ISP's SMTP server. The first obstacle was the performance, it took anywhere from 1-25 seconds to deliver the messages. So, since I'm not 100% concerned if every email gets there I created a Thread object to handle the emails so that I could continue.

Then I noticed that some email weren't getting to their destination when the load went up. I saw that anything after your tenth message in a 2-minute period (or something like that) would get dropped. So, in the catch() in my Thread's run() method, I would call run() again recursively up to 10 times to try the messages again. I could send more reliably not, but not more than about 75%.

Then I looked at the SMTP server. I installed a local one and this improved things dramatically. Since, it's dedicated it will churn through messages at an average completion rate above 99% -- and I log all failed messages. This works now, but I can't guarantee everyone a dedicated SMTP box...

What I'd like is a way to guarantee me 100% message success. I want some kind of queue that pops the top message and tries to send it up to a maximum number of retries, or signals an exception, before it moves on to the next message. Does this exist already somewhere, or what would be the best way to do this so that JavaMail would be intelilgent enough to read the SMTP responses to know that the message was successfully queued up?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2023
Added on Jan 7 2005
6 comments
218 views