Class ImapIdleChannelAdapterSpec
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,P>
org.springframework.integration.dsl.MessageProducerSpec<ImapIdleChannelAdapterSpec,ImapIdleChannelAdapter>
org.springframework.integration.mail.dsl.ImapIdleChannelAdapterSpec
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,DisposableBean
,FactoryBean<ImapIdleChannelAdapter>
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
,ComponentsRegistration
public class ImapIdleChannelAdapterSpec extends MessageProducerSpec<ImapIdleChannelAdapterSpec,ImapIdleChannelAdapter> implements ComponentsRegistration
- Since:
- 5.0
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
Fields Modifier and Type Field Description protected Map<Object,String>
componentsToRegister
protected boolean
externalReceiver
protected ImapMailReceiver
receiver
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target
-
Constructor Summary
Constructors Modifier Constructor Description protected
ImapIdleChannelAdapterSpec(ImapMailReceiver receiver)
protected
ImapIdleChannelAdapterSpec(ImapMailReceiver receiver, boolean externalReceiver)
-
Method Summary
Modifier and Type Method Description ImapIdleChannelAdapterSpec
adviceChain(Advice... adviceChain)
Configure a chain ofAdvice
objects for message delivery, applied to the downstream flow.ImapIdleChannelAdapterSpec
autoCloseFolder(boolean autoCloseFolder)
When configured tofalse
, the folder is not closed automatically after a fetch.ImapIdleChannelAdapterSpec
cancelIdleInterval(long interval)
How often to recycle the idle task (in case of a silently dropped connection).ImapIdleChannelAdapterSpec
embeddedPartsAsBytes(boolean embeddedPartsAsBytes)
When a header mapper is provided determine whether an embeddedPart
(e.gMessage
orMultipart
content is rendered as a byte[] in the payload.Map<Object,String>
getComponentsToRegister()
ImapIdleChannelAdapterSpec
headerMapper(HeaderMapper<javax.mail.internet.MimeMessage> headerMapper)
Set the header mapper; if a header mapper is not provided, the message payload is aMimeMessage
, when provided, the headers are mapped and the payload is theMimeMessage
content.ImapIdleChannelAdapterSpec
javaMailAuthenticator(javax.mail.Authenticator javaMailAuthenticator)
ImapIdleChannelAdapterSpec
javaMailProperties(Consumer<PropertiesBuilder> configurer)
Configure thejavaMailProperties
by invoking aConsumer
callback which is invoked with aPropertiesBuilder
.ImapIdleChannelAdapterSpec
javaMailProperties(Properties javaMailProperties)
ImapIdleChannelAdapterSpec
maxFetchSize(int maxFetchSize)
ImapIdleChannelAdapterSpec
searchTermStrategy(SearchTermStrategy searchTermStrategy)
ImapIdleChannelAdapterSpec
selector(Function<javax.mail.internet.MimeMessage,Boolean> selectorFunction)
Configure aFunction
to select messages.ImapIdleChannelAdapterSpec
selectorExpression(String selectorExpression)
Configure a SpEL expression to select messages.ImapIdleChannelAdapterSpec
selectorExpression(Expression selectorExpression)
Configure anExpression
to select messages.ImapIdleChannelAdapterSpec
sendingTaskExecutor(Executor sendingTaskExecutor)
Specify a task executor to be used to send messages to the downstream flow.ImapIdleChannelAdapterSpec
session(javax.mail.Session session)
A Java MailSession
to use.ImapIdleChannelAdapterSpec
shouldDeleteMessages(boolean shouldDeleteMessages)
ImapIdleChannelAdapterSpec
shouldMarkMessagesAsRead(boolean shouldMarkMessagesAsRead)
ImapIdleChannelAdapterSpec
shouldReconnectAutomatically(boolean shouldReconnectAutomatically)
ImapIdleChannelAdapterSpec
simpleContent(boolean simpleContent)
Determine how the content is rendered.ImapIdleChannelAdapterSpec
transactional()
Specify aTransactionInterceptor
Advice
with defaultPlatformTransactionManager
andDefaultTransactionAttribute
for the downstream flow.ImapIdleChannelAdapterSpec
transactional(TransactionInterceptor transactionInterceptor)
Specify aTransactionInterceptor
Advice
for the downstream flow.ImapIdleChannelAdapterSpec
transactional(TransactionManager transactionManager)
Specify aTransactionInterceptor
Advice
with the providedTransactionManager
and defaultDefaultTransactionAttribute
for the downstream flow.ImapIdleChannelAdapterSpec
transactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)
Configure aTransactionSynchronizationFactory
.ImapIdleChannelAdapterSpec
userFlag(String userFlag)
Set the name of the flag to use to flag messages when the server does not support \Recent but supports user flags; default "spring-integration-mail-adapter".Methods inherited from class org.springframework.integration.dsl.MessageProducerSpec
autoStartup, errorChannel, errorChannel, errorMessageStrategy, id, outputChannel, outputChannel, phase, sendTimeout, shouldTrack
Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Field Details
-
receiver
-
componentsToRegister
-
externalReceiver
protected final boolean externalReceiver
-
-
Constructor Details
-
Method Details
-
selectorExpression
Configure a SpEL expression to select messages. The root object for the expression evaluation is aMimeMessage
which should return a boolean result (true means select the message).- Parameters:
selectorExpression
- the selectorExpression.- Returns:
- the spec.
-
selectorExpression
Configure anExpression
to select messages. The root object for the expression evaluation is aMimeMessage
which should return a boolean result (true means select the message).- Parameters:
selectorExpression
- the selectorExpression.- Returns:
- the spec.
-
selector
public ImapIdleChannelAdapterSpec selector(Function<javax.mail.internet.MimeMessage,Boolean> selectorFunction)Configure aFunction
to select messages. The argument for the function is aMimeMessage
;apply
returns a boolean result (true means select the message).- Parameters:
selectorFunction
- the selectorFunction.- Returns:
- the spec.
- See Also:
FunctionExpression
-
session
A Java MailSession
to use.- Parameters:
session
- the session.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setSession(Session)
-
javaMailProperties
- Parameters:
javaMailProperties
- the javaMailProperties.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setJavaMailProperties(Properties)
-
javaMailProperties
Configure thejavaMailProperties
by invoking aConsumer
callback which is invoked with aPropertiesBuilder
.- Parameters:
configurer
- the configurer.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setJavaMailProperties(Properties)
-
javaMailAuthenticator
public ImapIdleChannelAdapterSpec javaMailAuthenticator(javax.mail.Authenticator javaMailAuthenticator)- Parameters:
javaMailAuthenticator
- the javaMailAuthenticator.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setJavaMailAuthenticator(Authenticator)
-
maxFetchSize
- Parameters:
maxFetchSize
- the maxFetchSize.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setMaxFetchSize(int)
-
shouldDeleteMessages
- Parameters:
shouldDeleteMessages
- the shouldDeleteMessages.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setShouldDeleteMessages(boolean)
-
searchTermStrategy
- Parameters:
searchTermStrategy
- the searchTermStrategy.- Returns:
- the spec.
- See Also:
ImapMailReceiver.setSearchTermStrategy(SearchTermStrategy)
-
shouldMarkMessagesAsRead
- Parameters:
shouldMarkMessagesAsRead
- the shouldMarkMessagesAsRead.- Returns:
- the spec.
- See Also:
ImapMailReceiver.setShouldMarkMessagesAsRead(Boolean)
-
userFlag
Set the name of the flag to use to flag messages when the server does not support \Recent but supports user flags; default "spring-integration-mail-adapter".- Parameters:
userFlag
- the flag.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setUserFlag(String)
-
headerMapper
public ImapIdleChannelAdapterSpec headerMapper(HeaderMapper<javax.mail.internet.MimeMessage> headerMapper)Set the header mapper; if a header mapper is not provided, the message payload is aMimeMessage
, when provided, the headers are mapped and the payload is theMimeMessage
content.- Parameters:
headerMapper
- the header mapper.- Returns:
- the spec.
- See Also:
AbstractMailReceiver.setUserFlag(String)
,embeddedPartsAsBytes(boolean)
-
embeddedPartsAsBytes
When a header mapper is provided determine whether an embeddedPart
(e.gMessage
orMultipart
content is rendered as a byte[] in the payload. Otherwise, leave as aPart
. These objects are not suitable for downstream serialization. Default: true.This has no effect if there is no header mapper, in that case the payload is the
MimeMessage
.- Parameters:
embeddedPartsAsBytes
- the embeddedPartsAsBytes to set.- Returns:
- the spec.
- See Also:
headerMapper(HeaderMapper)
-
autoCloseFolder
When configured tofalse
, the folder is not closed automatically after a fetch. It is the target application's responsibility to close it using theIntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE
header from the message produced by this channel adapter.- Parameters:
autoCloseFolder
- set tofalse
to keep folder opened.- Returns:
- the spec.
- Since:
- 5.2
- See Also:
AbstractMailReceiver.setAutoCloseFolder(boolean)
-
transactionSynchronizationFactory
public ImapIdleChannelAdapterSpec transactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)Configure aTransactionSynchronizationFactory
. Usually used to synchronize message deletion with some external transaction manager.- Parameters:
transactionSynchronizationFactory
- the transactionSynchronizationFactory.- Returns:
- the spec.
-
adviceChain
Configure a chain ofAdvice
objects for message delivery, applied to the downstream flow.- Parameters:
adviceChain
- the advice chain.- Returns:
- the spec.
-
transactional
Specify aTransactionInterceptor
Advice
with the providedTransactionManager
and defaultDefaultTransactionAttribute
for the downstream flow.- Parameters:
transactionManager
- theTransactionManager
to use.- Returns:
- the spec.
- Since:
- 5.2.5
-
transactional
Specify aTransactionInterceptor
Advice
for the downstream flow.- Parameters:
transactionInterceptor
- theTransactionInterceptor
to use.- Returns:
- the spec.
- See Also:
TransactionInterceptorBuilder
-
transactional
Specify aTransactionInterceptor
Advice
with defaultPlatformTransactionManager
andDefaultTransactionAttribute
for the downstream flow.- Returns:
- the spec.
-
sendingTaskExecutor
Specify a task executor to be used to send messages to the downstream flow.- Parameters:
sendingTaskExecutor
- the sendingTaskExecutor.- Returns:
- the spec.
- See Also:
ImapIdleChannelAdapter.setSendingTaskExecutor(Executor)
-
shouldReconnectAutomatically
public ImapIdleChannelAdapterSpec shouldReconnectAutomatically(boolean shouldReconnectAutomatically)- Parameters:
shouldReconnectAutomatically
- the shouldReconnectAutomatically.- Returns:
- the spec.
- See Also:
ImapIdleChannelAdapter.setShouldReconnectAutomatically(boolean)
-
cancelIdleInterval
How often to recycle the idle task (in case of a silently dropped connection). Seconds; default 120 (2 minutes).- Parameters:
interval
- the interval.- Returns:
- the spec.
- Since:
- 5.2
- See Also:
ImapMailReceiver.setCancelIdleInterval(long)
-
simpleContent
Determine how the content is rendered.- Parameters:
simpleContent
- true for simple content.- Returns:
- the spec.
- Since:
- 5.5
- See Also:
AbstractMailReceiver.setSimpleContent(boolean)
-
getComponentsToRegister
- Specified by:
getComponentsToRegister
in interfaceComponentsRegistration
-