Package org.apache.camel.component.mail
Class MailEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.support.ScheduledPollEndpoint
-
- org.apache.camel.component.mail.MailEndpoint
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.spi.HeaderFilterStrategyAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.0.0", scheme="imap,imaps,pop3,pop3s,smtp,smtps", title="IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS", syntax="imap:host:port", alternativeSyntax="imap:username:password@host:port", category=MAIL, headersClass=MailConstants.class) public class MailEndpoint extends org.apache.camel.support.ScheduledPollEndpoint implements org.apache.camel.spi.HeaderFilterStrategyAwareSend and receive emails using imap, pop3 and smtp protocols.
-
-
Constructor Summary
Constructors Constructor Description MailEndpoint()MailEndpoint(String endpointUri)MailEndpoint(String uri, MailComponent component, MailConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor, JavaMailSender sender)Creates a consumer using the given processor and senderorg.apache.camel.ExchangecreateExchange(javax.mail.Message message)org.apache.camel.ProducercreateProducer()org.apache.camel.ProducercreateProducer(JavaMailSender sender)Creates a producer using the given senderMailBindinggetBinding()MailConfigurationgetConfiguration()ContentTypeResolvergetContentTypeResolver()org.apache.camel.spi.HeaderFilterStrategygetHeaderFilterStrategy()org.apache.camel.spi.IdempotentRepositorygetIdempotentRepository()MailUidGeneratorgetMailUidGenerator()intgetMaxMessagesPerPoll()MailBoxPostProcessActiongetPostProcessAction()javax.mail.search.SearchTermgetSearchTerm()com.sun.mail.imap.SortTerm[]getSortTerm()booleanisIdempotentRepositoryRemoveOnCommit()voidsetBinding(MailBinding binding)Sets the binding used to convert from a Camel message to and from a Mail messagevoidsetConfiguration(MailConfiguration configuration)Sets the Mail configurationvoidsetContentTypeResolver(ContentTypeResolver contentTypeResolver)Resolver to determine Content-Type for file attachments.voidsetDelay(long delay)Milliseconds before the next poll.voidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)To use a customHeaderFilterStrategyto filter headers.voidsetIdempotentRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)A pluggable repository org.apache.camel.spi.IdempotentRepository which allows to cluster consuming from the same mailbox, and let the repository coordinate whether a mail message is valid for the consumer to process.voidsetIdempotentRepositoryRemoveOnCommit(boolean idempotentRepositoryRemoveOnCommit)When using idempotent repository, then when the mail message has been successfully processed and is committed, should the message id be removed from the idempotent repository (default) or be kept in the repository.voidsetMailUidGenerator(MailUidGenerator mailUidGenerator)A pluggableMailUidGeneratorthat allows to use custom logic to generate UUID of the mail message.voidsetMaxMessagesPerPoll(int maxMessagesPerPoll)Specifies the maximum number of messages to gather per poll.voidsetPostProcessAction(MailBoxPostProcessAction postProcessAction)Refers to anMailBoxPostProcessActionfor doing post processing tasks on the mailbox once the normal processing ended.voidsetSearchTerm(javax.mail.search.SearchTerm searchTerm)Refers to aSearchTermwhich allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc.voidsetSortTerm(com.sun.mail.imap.SortTerm[] sortTerm)Sorting order for messages.-
Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
MailEndpoint
public MailEndpoint()
-
MailEndpoint
public MailEndpoint(String endpointUri)
-
MailEndpoint
public MailEndpoint(String uri, MailComponent component, MailConfiguration configuration)
-
-
Method Detail
-
createProducer
public org.apache.camel.Producer createProducer() throws Exception- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createProducer
public org.apache.camel.Producer createProducer(JavaMailSender sender)
Creates a producer using the given sender
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception- Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor, JavaMailSender sender) throws ExceptionCreates a consumer using the given processor and sender- Throws:
Exception
-
createExchange
public org.apache.camel.Exchange createExchange(javax.mail.Message message)
-
getBinding
public MailBinding getBinding()
-
setBinding
public void setBinding(MailBinding binding)
Sets the binding used to convert from a Camel message to and from a Mail message
-
getConfiguration
public MailConfiguration getConfiguration()
-
setConfiguration
public void setConfiguration(MailConfiguration configuration)
Sets the Mail configuration
-
getHeaderFilterStrategy
public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
- Specified by:
getHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
To use a customHeaderFilterStrategyto filter headers.- Specified by:
setHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
getContentTypeResolver
public ContentTypeResolver getContentTypeResolver()
-
setContentTypeResolver
public void setContentTypeResolver(ContentTypeResolver contentTypeResolver)
Resolver to determine Content-Type for file attachments.
-
getMaxMessagesPerPoll
public int getMaxMessagesPerPoll()
-
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
Specifies the maximum number of messages to gather per poll. By default, no maximum is set. Can be used to set a limit of e.g. 1000 to avoid downloading thousands of files when the server starts up. Set a value of 0 or negative to disable this option.
-
getSearchTerm
public javax.mail.search.SearchTerm getSearchTerm()
-
setSearchTerm
public void setSearchTerm(javax.mail.search.SearchTerm searchTerm)
Refers to aSearchTermwhich allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc.
-
getSortTerm
public com.sun.mail.imap.SortTerm[] getSortTerm()
-
setSortTerm
public void setSortTerm(com.sun.mail.imap.SortTerm[] sortTerm)
Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability.
-
getPostProcessAction
public MailBoxPostProcessAction getPostProcessAction()
-
setPostProcessAction
public void setPostProcessAction(MailBoxPostProcessAction postProcessAction)
Refers to anMailBoxPostProcessActionfor doing post processing tasks on the mailbox once the normal processing ended.
-
getIdempotentRepository
public org.apache.camel.spi.IdempotentRepository getIdempotentRepository()
-
setIdempotentRepository
public void setIdempotentRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)
A pluggable repository org.apache.camel.spi.IdempotentRepository which allows to cluster consuming from the same mailbox, and let the repository coordinate whether a mail message is valid for the consumer to process. By default no repository is in use.
-
isIdempotentRepositoryRemoveOnCommit
public boolean isIdempotentRepositoryRemoveOnCommit()
-
setIdempotentRepositoryRemoveOnCommit
public void setIdempotentRepositoryRemoveOnCommit(boolean idempotentRepositoryRemoveOnCommit)
When using idempotent repository, then when the mail message has been successfully processed and is committed, should the message id be removed from the idempotent repository (default) or be kept in the repository. By default its assumed the message id is unique and has no value to be kept in the repository, because the mail message will be marked as seen/moved or deleted to prevent it from being consumed again. And therefore having the message id stored in the idempotent repository has little value. However this option allows to store the message id, for whatever reason you may have.
-
getMailUidGenerator
public MailUidGenerator getMailUidGenerator()
-
setMailUidGenerator
public void setMailUidGenerator(MailUidGenerator mailUidGenerator)
A pluggableMailUidGeneratorthat allows to use custom logic to generate UUID of the mail message.
-
setDelay
public void setDelay(long delay)
Milliseconds before the next poll.- Overrides:
setDelayin classorg.apache.camel.support.ScheduledPollEndpoint
-
-