org.apache.camel.component.mail
Class MailConsumer
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer
org.apache.camel.impl.ScheduledPollConsumer
org.apache.camel.component.mail.MailConsumer
- All Implemented Interfaces:
- Runnable, org.apache.camel.BatchConsumer, org.apache.camel.Consumer, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.ShutdownAware, org.apache.camel.SuspendableService
public class MailConsumer
- extends org.apache.camel.impl.ScheduledPollConsumer
- implements org.apache.camel.BatchConsumer, org.apache.camel.spi.ShutdownAware
A Consumer
which consumes messages from JavaMail using a
Transport
and dispatches them to the Processor
- Version:
Fields inherited from class org.apache.camel.impl.DefaultConsumer |
log |
Constructor Summary |
MailConsumer(MailEndpoint endpoint,
org.apache.camel.Processor processor,
org.springframework.mail.javamail.JavaMailSenderImpl sender)
|
Methods inherited from class org.apache.camel.impl.ScheduledPollConsumer |
doSuspend, getDelay, getInitialDelay, getPollStrategy, getTimeUnit, isPollAllowed, isUseFixedDelay, run, setDelay, setInitialDelay, setPollStrategy, setTimeUnit, setUseFixedDelay |
Methods inherited from class org.apache.camel.impl.DefaultConsumer |
getAsyncProcessor, getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, doResume, doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
Methods inherited from interface org.apache.camel.Service |
start, stop |
Methods inherited from interface org.apache.camel.SuspendableService |
isSuspended, resume, suspend |
DEFAULT_CONSUMER_DELAY
public static final long DEFAULT_CONSUMER_DELAY
- See Also:
- Constant Field Values
MailConsumer
public MailConsumer(MailEndpoint endpoint,
org.apache.camel.Processor processor,
org.springframework.mail.javamail.JavaMailSenderImpl sender)
doStart
protected void doStart()
throws Exception
- Overrides:
doStart
in class org.apache.camel.impl.ScheduledPollConsumer
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Overrides:
doStop
in class org.apache.camel.impl.ScheduledPollConsumer
- Throws:
Exception
poll
protected int poll()
throws Exception
- Specified by:
poll
in class org.apache.camel.impl.ScheduledPollConsumer
- Throws:
Exception
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
- Specified by:
setMaxMessagesPerPoll
in interface org.apache.camel.BatchConsumer
processBatch
public int processBatch(Queue<Object> exchanges)
throws Exception
- Specified by:
processBatch
in interface org.apache.camel.BatchConsumer
- Throws:
Exception
deferShutdown
public boolean deferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
- Specified by:
deferShutdown
in interface org.apache.camel.spi.ShutdownAware
getPendingExchangesSize
public int getPendingExchangesSize()
- Specified by:
getPendingExchangesSize
in interface org.apache.camel.spi.ShutdownAware
prepareShutdown
public void prepareShutdown()
- Specified by:
prepareShutdown
in interface org.apache.camel.spi.ShutdownAware
isBatchAllowed
public boolean isBatchAllowed()
- Specified by:
isBatchAllowed
in interface org.apache.camel.BatchConsumer
createExchanges
protected Queue<org.apache.camel.Exchange> createExchanges(javax.mail.Message[] messages)
throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
processExchange
protected void processExchange(org.apache.camel.Exchange exchange)
throws Exception
- Strategy to process the mail message.
- Throws:
Exception
processCommit
protected void processCommit(javax.mail.Message mail,
org.apache.camel.Exchange exchange)
- Strategy to flag the message after being processed.
- Parameters:
mail
- the mail messageexchange
- the exchange
processRollback
protected void processRollback(javax.mail.Message mail,
org.apache.camel.Exchange exchange)
- Strategy when processing the exchange failed.
- Parameters:
mail
- the mail messageexchange
- the exchange
getEndpoint
public MailEndpoint getEndpoint()
- Specified by:
getEndpoint
in interface org.apache.camel.Consumer
- Overrides:
getEndpoint
in class org.apache.camel.impl.DefaultConsumer
Apache CAMEL