public class MailConsumer extends ScheduledBatchPollingConsumer
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_CONSUMER_DELAY |
static java.lang.String |
POP3_UID |
maxMessagesPerPoll, pendingExchanges, shutdownRunningTask
log
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
MailConsumer(MailEndpoint endpoint,
Processor processor,
JavaMailSender sender) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Queue<Exchange> |
createExchanges(javax.mail.Message[] messages) |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
protected java.lang.String |
generatePop3Uid(javax.mail.Message message)
Generates an UID of the POP3Message
|
MailEndpoint |
getEndpoint()
Gets the endpoint this
Consumer consumes from. |
protected int |
poll()
The polling method which is invoked periodically to poll this consumer
|
int |
processBatch(java.util.Queue<java.lang.Object> exchanges)
Processes the list of
Exchange objects in a batch. |
protected void |
processCommit(javax.mail.Message mail,
Exchange exchange)
Strategy to flag the message after being processed.
|
protected void |
processExchange(Exchange exchange)
Strategy to process the mail message.
|
protected void |
processRollback(javax.mail.Message mail,
Exchange exchange)
Strategy when processing the exchange failed.
|
deferShutdown, getMaxMessagesPerPoll, getPendingExchangesSize, isBatchAllowed, prepareShutdown, processEmptyMessage, setMaxMessagesPerPoll
afterPoll, beforePoll, doShutdown, doSuspend, getBackoffCounter, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDelay, getInitialDelay, getPollStrategy, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isPollAllowed, isPolling, isSchedulerStarted, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, onInit, run, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay, startScheduler
createUoW, doneUoW, getAsyncProcessor, getExceptionHandler, getProcessor, getRoute, handleException, handleException, setExceptionHandler, setRoute, toString
doResume, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isSuspended, resume, suspend
public static final java.lang.String POP3_UID
public static final long DEFAULT_CONSUMER_DELAY
public MailConsumer(MailEndpoint endpoint, Processor processor, JavaMailSender sender)
protected void doStart() throws java.lang.Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ScheduledPollConsumer
java.lang.Exception
ServiceSupport.doStop()
protected void doStop() throws java.lang.Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class ScheduledPollConsumer
java.lang.Exception
ServiceSupport.doStart()
protected int poll() throws java.lang.Exception
ScheduledPollConsumer
poll
in class ScheduledPollConsumer
java.lang.Exception
- can be thrown if an exception occurred during pollingpublic int processBatch(java.util.Queue<java.lang.Object> exchanges) throws java.lang.Exception
BatchConsumer
Exchange
objects in a batch.
Each message exchange will be processed individually but the batch
consumer will add properties with the current index and total in the batch.
The items in the Queue may actually be Holder objects that store other
data alongside the Exchange.exchanges
- list of items in this batchjava.lang.Exception
- if an internal processing error has occurred.protected java.util.Queue<Exchange> createExchanges(javax.mail.Message[] messages) throws javax.mail.MessagingException
javax.mail.MessagingException
protected void processExchange(Exchange exchange) throws java.lang.Exception
java.lang.Exception
protected void processCommit(javax.mail.Message mail, Exchange exchange)
mail
- the mail messageexchange
- the exchangeprotected void processRollback(javax.mail.Message mail, Exchange exchange)
mail
- the mail messageexchange
- the exchangeprotected java.lang.String generatePop3Uid(javax.mail.Message message)
message
- the POP3Messagepublic MailEndpoint getEndpoint()
Consumer
Consumer
consumes from.getEndpoint
in interface Consumer
getEndpoint
in class DefaultConsumer
Copyright © 2007-2014 Red Hat, Inc.. All Rights Reserved.