The best thing you could do is to look at the RemoteDelivery mailet.
This uses its own spool to locally queue and retry messages.
Adapt or extend this mailet to use your db rather than sending them via
SMTP and you have your answer.
You will also get the benefit of this mailets retry configurations.
d.
|---------+---------------------------->
| | v r |
| | <[EMAIL PROTECTED]|
| | m> |
| | |
| | 24/08/2005 01:19 |
| | Please respond to|
| | "James Users |
| | List" |
|---------+---------------------------->
>-------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: [email protected]
|
| cc: vish ramamurthy <[EMAIL PROTECTED]>
|
| Subject: Custom queue and mail recovery
|
>-------------------------------------------------------------------------------------------------------------------------------|
I am using James to process incoming mail and save the
contents to a database. (Note, that I am not
forwarding the mail to users).
In case of a database failure, I would like to queue
up the mail in a custom mail queue and process it
later when the database is available.
For starters, I have a custom mailet where I process
the mail, (myCustomMailet.java). When I detect a db
unavailable situation, I do a
jamesMail.setState("myprocessor");
which moves the mail to the myqueue directory.
I have created a processor called "myprocessor" in the
config.xml file to which, I forward mail, when the db
is
down.
<processor name="myprocessor">
<mailet match="All" class="ToRepository">
<repositoryPath>file://${app.home}/../../../mail-queue/myqueue/</repositoryPath>
</mailet>
</processor>
Subsequently, when the db comes up, I shutdown James
and move the contents of the myqueue directory to the
spool directory. I restart James, hoping that the
mails would now be processed, but for some reason
James does not process them and returns them back to
the myqueue directory.
Ideally, I would like to write a matcher/mailet that
would fetch from myqueue (if there are any files) and
dump them into the spool queue.
Another question along those lines is, how do I fetch
mail from a particular queue ?
Thanks
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
***************************************************************************
The information in this e-mail is confidential and for use by the addressee(s)
only. If you are not the intended recipient (or responsible for delivery of the
message to the intended recipient) please notify us immediately on 0141 306
2050 and delete the message from your computer. You may not copy or forward it
or use or disclose its contents to any other person. As Internet communications
are capable of data corruption Student Loans Company Limited does not accept
any responsibility for changes made to this message after it was sent. For
this reason it may be inappropriate to rely on advice or opinions contained in
an e-mail without obtaining written confirmation of it. Neither Student Loans
Company Limited or the sender accepts any liability or responsibility for
viruses as it is your responsibility to scan attachments (if any). Opinions and
views expressed in this e-mail are those of the sender and may not reflect the
opinions and views of The Student Loans Company Limit
ed.
This footnote also confirms that this email message has been swept for the
presence of computer viruses.
**************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]