org.apache.james.transport.mailets
Class Retry

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.transport.mailets.Retry
All Implemented Interfaces:
java.lang.Runnable, org.apache.mailet.Mailet, org.apache.mailet.MailetConfig

public class Retry
extends org.apache.mailet.base.GenericMailet
implements java.lang.Runnable

This Mailet retries delivery of a mail based on schedule specified in the James configuration file by the 'delayTime' attribute. The format of the 'delayTime' attribute is: [attempts*]delay[units]

For example, if the delay times were specified as follows:
4*15 minutes 3*1 hour 3*4 hours 10 after the initial failure, the message will be retried by sending it to the processor specified by the 'retryProcessor' attribute, as per the following schedule: 1) 4 attempts will be made every 15 minutes. 2) 3 attempts will be made every hour. 3) 3 attempts will be made every 4 hours. If the message still fails, it will be sent for error processing to the processor specified by the 'errorProcessor' attribute.

Following list summarizes all the attributes of this Mailet that can be configured:


Field Summary
static java.lang.String ORIGINAL_ERROR
           
 
Constructor Summary
Retry()
           
 
Method Summary
 void destroy()
          Stops all the worker threads that are waiting for messages.
 java.lang.String getMailetInfo()
           
 void init()
          Initializes all arguments based on configuration values specified in the James configuration file.
protected  void preprocess(org.apache.mailet.Mail mail)
          Pre-processes the Mail object before resending.
 void run()
          Handles checking the retrying spool for new mail and retrying them if there are ready for retrying.
 void service(org.apache.mailet.Mail mail)
          Checks if maximum retry count has been reached.
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORIGINAL_ERROR

public static final java.lang.String ORIGINAL_ERROR
See Also:
Constant Field Values
Constructor Detail

Retry

public Retry()
Method Detail

init

public void init()
          throws javax.mail.MessagingException
Initializes all arguments based on configuration values specified in the James configuration file.

Overrides:
init in class org.apache.mailet.base.GenericMailet
Throws:
javax.mail.MessagingException - on failure to initialize attributes.

getMailetInfo

public java.lang.String getMailetInfo()
Specified by:
getMailetInfo in interface org.apache.mailet.Mailet
Overrides:
getMailetInfo in class org.apache.mailet.base.GenericMailet

service

public void service(org.apache.mailet.Mail mail)
             throws javax.mail.MessagingException
Checks if maximum retry count has been reached. If it is, then it forwards the message to the error processor; otherwise writes it to the retry repository.

Specified by:
service in interface org.apache.mailet.Mailet
Specified by:
service in class org.apache.mailet.base.GenericMailet
Parameters:
mail - the mail to be retried.
Throws:
javax.mail.MessagingException - on failure to send it to the error processor.
See Also:
Mailet.service(org.apache.mailet.Mail)

destroy

public void destroy()
Stops all the worker threads that are waiting for messages. This method is called by the Mailet container before taking this Mailet out of service.

Specified by:
destroy in interface org.apache.mailet.Mailet
Overrides:
destroy in class org.apache.mailet.base.GenericMailet

run

public void run()
Handles checking the retrying spool for new mail and retrying them if there are ready for retrying.

Specified by:
run in interface java.lang.Runnable

preprocess

protected void preprocess(org.apache.mailet.Mail mail)
Pre-processes the Mail object before resending.

This method can be used by subclasses to perform application specific processing on the Mail object, such as, adding and/or removing application specific Mail attributes etc. The default implementation leaves the Mail object intact.

Parameters:
mail - mail object that can be customized before resending.


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.