com.goldeninnovations.smp
Interface MessageSpool

All Known Implementing Classes:
MemoryMessageSpool

public interface MessageSpool

Implement this interface to provide a custom spooling implementation.

MessageSpool is used by the SMPServer to store a newly received message until the MessageProcessors are ready to process it.


Method Summary
 EmailMessage createMessage()
          Factory method called when a new message is being processed.
 EmailMessage deSpoolMessage()
          Returns the newt EmailMessage in the spool.
 boolean spoolMessage(EmailMessage message)
          Stores a new message in the spool.
 

Method Detail

createMessage

EmailMessage createMessage()
Factory method called when a new message is being processed. Allows MessageSpool implementation to provide a custom EmailMessage implementation.

Returns:
a new concrete EmailMessage.

spoolMessage

boolean spoolMessage(EmailMessage message)
Stores a new message in the spool. Once this method returns, the SMPServer assumes it has been saved and can notify the sender that the message was accepted.

Parameters:
message - the EmailMessage to spool.
Returns:
false if the message was not saved successfully.

deSpoolMessage

EmailMessage deSpoolMessage()
                            throws InterruptedException
Returns the newt EmailMessage in the spool. If the spool is empty, implementations can either return null, or block until the next available message.

Returns:
the next EmailMessage, or null if queue is empty and non-blocking.
Throws:
InterruptedException - thrown for blocking implementations that are interrupted.


Copyright © 2010 Eric Daugherty. All Rights Reserved.