|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.email.BatchEmailListener
public class BatchEmailListener
An EmailListener that batches up EmailEvent objects and periodically sends out corresponding pieces of email using an EmailMessageSender. Each batch of email messages is sent using a single connection to the mail server.
Two properties control how often the batch sends are
performed - maxBatchSize
and
sendSchedule
. If maxBatchSize
is
specified, a send is performed whenever the number of
batched email events reaches maxBatchSize
.
Also, if sendSchedule
is specified, sends are
performed according to the schedule. At least one of
these properties must be specified for the service to
function properly.
Since the sendEmailEvent
method may result
in a batch send of all the collected events (if the number
of events reaches maxBatchSize
), you should not
use the BatchEmailListener service directly, but rather in
conjunction with the EmailListenerQueue (i.e., configure
the EmailListenerQueue to have BatchEmailListener as a
listener).
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
BatchEmailListener()
|
Method Summary | |
---|---|
void |
clearDeadEmailEvents()
Clears the current dead email queue |
void |
doStartService()
Called after the service has been created, placed into the naming hierarchy, and initialized with its configured property values. |
void |
doStopService()
Called when the service is required to shut down. |
Schedule |
getClearDeadEmailSchedule()
Returns the Schedule for clearing the Dead Email Queue. |
int |
getDeadEmailCount()
Gets the number of dead letters (letters that couldn't be sent due to errors) |
java.util.Dictionary |
getDeadEmailDictionary()
Returns a Dictionary object with each row consisting of an undelivered EmailEvent and its corresponding EmailException |
java.util.Enumeration |
getDeadEmailEvents()
Returns an Enumeration of undelivered EmailEvent objects |
java.util.Enumeration |
getDeadEmailExceptions()
Returns an Enumeration of EmailExceptions that belong to undelivered EmailEvents |
EmailMessageSender |
getEmailMessageSender()
Returns the EmailMessageSender used to send email. |
int |
getMaxBatchSize()
Returns the maximum number of EmailEvents that will be batched before a send is performed. |
Scheduler |
getScheduler()
Returns the Scheduler responsible for scheduling batch sends. |
Schedule |
getSendSchedule()
Returns the Schedule for perfoming batch sends. |
boolean |
isCollectDeadEmail()
|
void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
Called when a scheduled job tied to this object occurs. |
void |
sendDeadEmail()
Sends all of the email currently in the dead letter queue. |
void |
sendEmailEvent(EmailEvent pEvent)
Adds the given email event to the internal batch queue. |
void |
setClearDeadEmailSchedule(Schedule pClearDeadEmailSchedule)
Sets the Schedule for clearing the Dead Email Queue. |
void |
setCollectDeadEmail(boolean p)
|
void |
setEmailMessageSender(EmailMessageSender pSender)
Sets the EmailMessageSender used to send email. |
void |
setMaxBatchSize(int pMaxBatchSize)
Sets the maximum number of EmailEvents that will be batched before a send is performed. |
void |
setScheduler(Scheduler pScheduler)
Sets the Scheduler responsible for scheduling batch sends. |
void |
setSendSchedule(Schedule pSendSchedule)
Sets the Schedule for perfoming batch sends. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public BatchEmailListener()
Method Detail |
---|
public EmailMessageSender getEmailMessageSender()
public void setEmailMessageSender(EmailMessageSender pSender)
public int getMaxBatchSize()
public void setMaxBatchSize(int pMaxBatchSize)
public Scheduler getScheduler()
public void setScheduler(Scheduler pScheduler)
public Schedule getSendSchedule()
public void setSendSchedule(Schedule pSendSchedule)
public Schedule getClearDeadEmailSchedule()
public void setClearDeadEmailSchedule(Schedule pClearDeadEmailSchedule)
public void setCollectDeadEmail(boolean p)
public boolean isCollectDeadEmail()
public int getDeadEmailCount()
public java.util.Dictionary getDeadEmailDictionary()
public java.util.Enumeration getDeadEmailEvents()
public java.util.Enumeration getDeadEmailExceptions()
public void clearDeadEmailEvents()
public void sendDeadEmail()
getDeadEmailDictionary
or
getDeadEmailExceptions
method to examine the reason
why the email wasn't sent before using this method.
public void sendEmailEvent(EmailEvent pEvent) throws EmailException
maxBatchSize
,
this also causes all the collected events to be sent as
email messages.
sendEmailEvent
in interface EmailListener
EmailException
public void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- calling the jobpJob
- the ScheduledJobpublic void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the service had a problem
starting uppublic void doStopService() throws ServiceException
doStopService
in class GenericService
ServiceException
- if the service had a problem
shutting down
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |