JBoss Clustered Service that sends emails from txt file

Posted by michael lucas on Stack Overflow See other posts from Stack Overflow or by michael lucas
Published on 2010-03-15T11:14:51Z Indexed on 2010/03/15 11:19 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

I need a little push in the right direction. Here's my problem: I have to create an ultra-reliable service that sends email messages to clients whose addresses are stored in txt file on FTP server. Single txt file may contain unlimited number of entries. Most often the file contains about 300,000 entries.

Service exposes interface with just two simple methods:

TaskHandle sendEmails(String ftpFilePath);
ProcessStatus checkProcessStatus(TaskHandle taskHandle);

Method sendEmails() returns TaskHandle by which we can ask for ProcessStatus.

For such a service to be reliable clustering is necessary. Processing single txt file might take a long time. Restarting one node in a cluster should have no impact on sending emails.

We use JBoss AS 4.2.0 which comes with a nice HASingletonController that ensure one instance of service is running at given time.

But once a fail-over happens, the second service should continue work from where the first one stopped.

How can I share state between nodes in a cluster in such a way that leaves no possibility of sending some emails twice?

© Stack Overflow or respective owner

Related posts about jboss

Related posts about java