S
- the target MailInboundChannelAdapterSpec
implementation type.R
- the target AbstractMailReceiver
implementation type.public abstract class MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S,R>,R extends AbstractMailReceiver> extends MessageSourceSpec<S,MailReceivingMessageSource> implements ComponentsRegistration
Modifier and Type | Field and Description |
---|---|
protected boolean |
externalReceiver |
protected R |
receiver |
PARSER, target
logger
DEFAULT_PHASE
OBJECT_TYPE_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
protected |
MailInboundChannelAdapterSpec(R receiver) |
protected |
MailInboundChannelAdapterSpec(R receiver,
boolean externalReceiver) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertReceiver() |
S |
autoCloseFolder(boolean autoCloseFolder)
When configured to
false , the folder is not closed automatically after a fetch. |
MailReceivingMessageSource |
doGet() |
S |
embeddedPartsAsBytes(boolean embeddedPartsAsBytes)
|
Map<Object,String> |
getComponentsToRegister() |
S |
headerMapper(HeaderMapper<MimeMessage> headerMapper)
Set the header mapper; if a header mapper is not provided, the message payload is
a
MimeMessage , when provided, the headers are mapped and the payload is
the MimeMessage content. |
S |
javaMailAuthenticator(Authenticator javaMailAuthenticator)
The Java Mail
Authenticator . |
S |
javaMailProperties(java.util.function.Consumer<PropertiesBuilder> configurer)
Configure the
javaMailProperties by invoking a Consumer callback which
is invoked with a PropertiesBuilder . |
S |
javaMailProperties(Properties javaMailProperties)
The Java Mail properties.
|
S |
maxFetchSize(int maxFetchSize)
The maximum for fetch size.
|
S |
selector(java.util.function.Function<MimeMessage,Boolean> selectorFunction)
Configure a
Function to select messages. |
S |
selectorExpression(Expression selectorExpression)
Configure a SpEL expression to select messages.
|
S |
selectorExpression(String selectorExpression)
Configure a SpEL expression to select messages.
|
S |
session(Session session)
Provide the Java Mail
Session to use. |
S |
shouldDeleteMessages(boolean shouldDeleteMessages)
A flag to specify if messages should be deleted after receive.
|
S |
simpleContent(boolean simpleContent)
Determine how the content is rendered.
|
S |
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 .
|
messageHeaders
_this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
protected final R extends AbstractMailReceiver receiver
protected final boolean externalReceiver
protected MailInboundChannelAdapterSpec(R receiver)
protected MailInboundChannelAdapterSpec(R receiver, boolean externalReceiver)
public S selectorExpression(String selectorExpression)
MimeMessage
which should return a boolean
result (true means select the message).selectorExpression
- the selectorExpression.protected void assertReceiver()
public S selectorExpression(Expression selectorExpression)
MimeMessage
which should return a boolean
result (true means select the message).selectorExpression
- the selectorExpression.public S selector(java.util.function.Function<MimeMessage,Boolean> selectorFunction)
Function
to select messages. The argument for the function
is a MimeMessage
; apply
returns a boolean
result (true means select the message).selectorFunction
- the selectorFunction.FunctionExpression
public S session(Session session)
Session
to use.session
- the session.AbstractMailReceiver.setSession(Session)
public S javaMailProperties(Properties javaMailProperties)
javaMailProperties
- the javaMailProperties.AbstractMailReceiver.setJavaMailProperties(Properties)
public S javaMailProperties(java.util.function.Consumer<PropertiesBuilder> configurer)
javaMailProperties
by invoking a Consumer
callback which
is invoked with a PropertiesBuilder
.configurer
- the configurer.AbstractMailReceiver.setJavaMailProperties(Properties)
public S javaMailAuthenticator(Authenticator javaMailAuthenticator)
Authenticator
.javaMailAuthenticator
- the javaMailAuthenticator.AbstractMailReceiver.setJavaMailAuthenticator(Authenticator)
public S maxFetchSize(int maxFetchSize)
maxFetchSize
- the maxFetchSize.AbstractMailReceiver.setMaxFetchSize(int)
public S shouldDeleteMessages(boolean shouldDeleteMessages)
shouldDeleteMessages
- the shouldDeleteMessages.AbstractMailReceiver.setShouldDeleteMessages(boolean)
public S userFlag(String userFlag)
userFlag
- the flag.AbstractMailReceiver.setUserFlag(String)
public S headerMapper(HeaderMapper<MimeMessage> headerMapper)
MimeMessage
, when provided, the headers are mapped and the payload is
the MimeMessage
content.headerMapper
- the header mapper.AbstractMailReceiver.setUserFlag(String)
,
embeddedPartsAsBytes(boolean)
public S embeddedPartsAsBytes(boolean embeddedPartsAsBytes)
Part
(e.g Message
or
Multipart
content is rendered as a byte[] in the payload.
Otherwise, leave as a Part
. 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
.
embeddedPartsAsBytes
- the embeddedPartsAsBytes to set.headerMapper(HeaderMapper)
public S simpleContent(boolean simpleContent)
simpleContent
- true for simple content.AbstractMailReceiver.setSimpleContent(boolean)
public S autoCloseFolder(boolean autoCloseFolder)
false
, the folder is not closed automatically after a fetch.
It is the target application's responsibility to close it using the
IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE
header
from the message produced by this channel adapter.autoCloseFolder
- set to false
to keep folder opened.AbstractMailReceiver.setAutoCloseFolder(boolean)
public Map<Object,String> getComponentsToRegister()
getComponentsToRegister
in interface ComponentsRegistration
public MailReceivingMessageSource doGet()
doGet
in class IntegrationComponentSpec<S extends MailInboundChannelAdapterSpec<S,R>,MailReceivingMessageSource>