|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectSK.gnome.dwarf.GenericService
SK.gnome.dwarf.thread.ThreadService
SK.gnome.dwarf.mail.smtp.FileMailQueue
Provides filesystem-based mail queue.
The queue is stored in a special directory which must be set via the setQueueDir(File)
method. It contains two subdirectories "msgs" and "nodes". The first one stores
messages and the second one node queues. Each message is represented by a subdirectory with name
equal to the message's SMTP identification string. (Subdirectories starting with dot are regarded
temporary and deleted automatically after some time.) Each subdirectory contains serialized form
of the SMTP envelope data in file named ".control" and the raw message data in file named
".message". In addition, there are one or more files with the serialized form of each
message recipient named "xxxx@some.domain.com", where xxxx is hexadecimal value
of the hashed recipient's address.
The "nodes" subdirectory contains the scheduling information for all nodes, which are
in fact domain names of all recipients of all messages in the queue. Each node is represented by
a single subdirectory containing references to all messages enqueued for this particular node.
A reference is a zero-length file with name "xxxxx-yyyyy-zzzzz", where the first part
is message's SMTP identification string, the second part is Node identification used for
enqueueing the message, and the third one is a time in milliseconds for which the message had been
enqueued. Zero time means that the message should be dequeued as soon as possible, probably in the
very next queue run.
If a message with SMTP id 123671263817_32398 is enqueued for delivery to "joe@public.com" by a Node with 1242482349_09312 id, for example, the "nodes/public.com" subdirectory must contain a file named "123671263817_32398-1232482349_09312-1233074634323", where the last number is time after which message may be dequeued for further processing.
Note: since the serialized queue objects contains also paths to files, it is not safe to move the queue content to another location.
| Field Summary |
| Fields inherited from class SK.gnome.dwarf.thread.ThreadService |
daemon, thread |
| Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
| Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
| Constructor Summary | |
FileMailQueue(java.lang.String name)
|
|
| Method Summary | |
SMTPMessage |
dequeueMessage(Node node)
Dequeues a message for the given node. |
protected boolean |
enableThread()
|
void |
enqueueMessage(SMTPMessage message,
Node node,
long time)
Enqueues the message for the given node and time. |
SMTPMessage |
getMessageInstance()
Returns a new SMTPMessage instance. |
void |
init(SK.gnome.dwarf.Server parent)
|
void |
listMessages(boolean details,
java.io.PrintWriter out)
Lists all messages in the queue. |
java.util.Iterator |
listNodes()
Lists all active nodes. |
protected void |
loop()
|
void |
setDeleteFinished(boolean enable)
|
void |
setCheckpoint(int time)
|
void |
setQueueDir(java.io.File dir)
|
| Methods inherited from class SK.gnome.dwarf.thread.ThreadService |
finish, run, setDaemon, shutdown, start, stop |
| Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public FileMailQueue(java.lang.String name)
| Method Detail |
public void setQueueDir(java.io.File dir)
public void setCheckpoint(int time)
public void setDeleteFinished(boolean enable)
public void init(SK.gnome.dwarf.Server parent)
throws SK.gnome.dwarf.ServiceException
init in interface SK.gnome.dwarf.ServiceSK.gnome.dwarf.ServiceException
public SMTPMessage getMessageInstance()
throws MailException
MailQueueSMTPMessage instance.
getMessageInstance in interface MailQueueMailException - if an error occured
public void listMessages(boolean details,
java.io.PrintWriter out)
throws MailException
MailQueueA short or detailed information is printed out about each message waiting in the queue.
listMessages in interface MailQueuedetails - true to print message details, false otherwiseout - the output stream
MailException - if an error occured
public void enqueueMessage(SMTPMessage message,
Node node,
long time)
throws MailException
MailQueueThe message as well as its recipient collection are stored to the mail queue and may
be returned later via the MailQueue.dequeueMessage(Node) method, if the recipients are targeted
for the given node and other conditions are met, too. In other words, the message
is scheduled to be processed for the given node at the specified time.
enqueueMessage in interface MailQueuemessage - the messagenode - the node to enqueue the message fortime - the time for next processing or delivery attempt
MailException - if an error occured
public SMTPMessage dequeueMessage(Node node)
throws MailException
MailQueueOnly those messages may be returned which had been enqueued for the given node and time
less or equal the current system time, unless the node's Node.getForceDelivery()
returns true. Furthemore, messages which had been already processed for the same Node
object previously must not be returned. A returned message's SMTPMessage.getRecipients()
method may return only those recipients which are targeted for the given node.
After dequeueing the recipients are removed from the queue processing and may be included
in it again only by calling MailQueue.enqueueMessage(SMTPMessage, Node, long) on the same
message object.
dequeueMessage in interface MailQueuenode - the node to dequeue a message for
MailException - if an error occuredpublic java.util.Iterator listNodes()
MailQueueA node is active only if it contains any messages for processing. The returned iteration contains java.lang.String objects with the node names.
listNodes in interface MailQueueprotected boolean enableThread()
protected void loop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||