Class MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S,R>,R extends AbstractMailReceiver>
java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<S,H>
org.springframework.integration.dsl.MessageSourceSpec<S,MailReceivingMessageSource>
org.springframework.integration.mail.dsl.MailInboundChannelAdapterSpec<S,R>
- Type Parameters:
S
- the targetMailInboundChannelAdapterSpec
implementation type.R
- the targetAbstractMailReceiver
implementation type.
- All Implemented Interfaces:
DisposableBean
,FactoryBean<MailReceivingMessageSource>
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
,ComponentsRegistration
- Direct Known Subclasses:
ImapMailInboundChannelAdapterSpec
,Pop3MailInboundChannelAdapterSpec
public abstract class MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S,R>,R extends AbstractMailReceiver>
extends MessageSourceSpec<S,MailReceivingMessageSource>
implements ComponentsRegistration
- Since:
- 5.0
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, target
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ModifierConstructorDescriptionprotected
MailInboundChannelAdapterSpec
(R receiver) protected
MailInboundChannelAdapterSpec
(R receiver, boolean externalReceiver) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
autoCloseFolder
(boolean autoCloseFolder) When configured tofalse
, the folder is not closed automatically after a fetch.doGet()
embeddedPartsAsBytes
(boolean embeddedPartsAsBytes) flaggedAsFallback
(boolean flaggedAsFallback) Whether theFlags.Flag.FLAGGED
flag should be added to the message when\Recent
or user flags are not supported on mail server.headerMapper
(HeaderMapper<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.javaMailAuthenticator
(Authenticator javaMailAuthenticator) The Java MailAuthenticator
.javaMailProperties
(Consumer<PropertiesBuilder> configurer) Configure thejavaMailProperties
by invoking aConsumer
callback which is invoked with aPropertiesBuilder
.javaMailProperties
(Properties javaMailProperties) The Java Mail properties.maxFetchSize
(int maxFetchSize) The maximum for fetch size.selector
(Function<MimeMessage, Boolean> selectorFunction) Configure aFunction
to select messages.selectorExpression
(String selectorExpression) Configure a SpEL expression to select messages.selectorExpression
(Expression selectorExpression) Configure a SpEL expression to select messages.Provide the Java MailSession
to use.shouldDeleteMessages
(boolean shouldDeleteMessages) A flag to specify if messages should be deleted after receive.simpleContent
(boolean simpleContent) Determine how the content is rendered.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.MessageSourceSpec
messageHeaders
Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, getId, getObject, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Field Details
-
receiver
-
externalReceiver
protected final boolean externalReceiver
-
-
Constructor Details
-
MailInboundChannelAdapterSpec
-
MailInboundChannelAdapterSpec
-
-
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.
-
assertReceiver
protected void assertReceiver() -
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.
-
selector
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:
-
session
Provide the Java MailSession
to use.- Parameters:
session
- the session.- Returns:
- the spec.
- See Also:
-
javaMailProperties
The Java Mail properties.- Parameters:
javaMailProperties
- the javaMailProperties.- Returns:
- the spec.
- See Also:
-
javaMailProperties
Configure thejavaMailProperties
by invoking aConsumer
callback which is invoked with aPropertiesBuilder
.- Parameters:
configurer
- the configurer.- Returns:
- the spec.
- See Also:
-
javaMailAuthenticator
The Java MailAuthenticator
.- Parameters:
javaMailAuthenticator
- the javaMailAuthenticator.- Returns:
- the spec.
- See Also:
-
maxFetchSize
The maximum for fetch size.- Parameters:
maxFetchSize
- the maxFetchSize.- Returns:
- the spec.
- See Also:
-
shouldDeleteMessages
A flag to specify if messages should be deleted after receive.- Parameters:
shouldDeleteMessages
- the shouldDeleteMessages.- Returns:
- the spec.
- See Also:
-
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:
-
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:
-
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:
-
simpleContent
Determine how the content is rendered.- Parameters:
simpleContent
- true for simple content.- Returns:
- the spec.
- See Also:
-
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:
-
flaggedAsFallback
Whether theFlags.Flag.FLAGGED
flag should be added to the message when\Recent
or user flags are not supported on mail server.- Parameters:
flaggedAsFallback
-false
to not addFlags.Flag.FLAGGED
flag as a fallback.- Returns:
- the spec.
- Since:
- 6.4
-
getComponentsToRegister
- Specified by:
getComponentsToRegister
in interfaceComponentsRegistration
-
doGet
- Overrides:
doGet
in classIntegrationComponentSpec<S extends MailInboundChannelAdapterSpec<S,
R>, MailReceivingMessageSource>
-