S
- the target MailInboundChannelAdapterSpec
implementation type.R
- the target AbstractMailReceiver
implementation type.public abstract class MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S,R>,R extends org.springframework.integration.mail.AbstractMailReceiver> extends MessageSourceSpec<S,org.springframework.integration.mail.MailReceivingMessageSource> implements ComponentsRegistration
MessageSourceSpec
for a MailReceivingMessageSource
.Modifier and Type | Field and Description |
---|---|
protected boolean |
externalReceiver |
protected R |
receiver |
logger, PARSER, target
Modifier | Constructor and Description |
---|---|
protected |
MailInboundChannelAdapterSpec(R receiver) |
protected |
MailInboundChannelAdapterSpec(R receiver,
boolean externalReceiver) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertReceiver() |
org.springframework.integration.mail.MailReceivingMessageSource |
doGet() |
S |
embeddedPartsAsBytes(boolean embeddedPartsAsBytes)
When a header mapper is provided determine whether an embedded
Part (e.g
Message or Multipart content is rendered as a byte[] in the
payload. |
java.util.Collection<java.lang.Object> |
getComponentsToRegister() |
S |
headerMapper(org.springframework.integration.mapping.HeaderMapper<javax.mail.internet.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(javax.mail.Authenticator javaMailAuthenticator)
The Java Mail
Authenticator . |
S |
javaMailProperties(Consumer<PropertiesBuilder> configurer)
Configure the
javaMailProperties by invoking a Consumer callback which
is invoked with a PropertiesBuilder . |
S |
javaMailProperties(java.util.Properties javaMailProperties)
The Java Mail properties.
|
S |
maxFetchSize(int maxFetchSize)
The maximum for fetch size.
|
S |
selector(Function<javax.mail.internet.MimeMessage,java.lang.Boolean> selectorFunction)
Configure a
Function to select messages. |
S |
selectorExpression(org.springframework.expression.Expression selectorExpression)
Configure a SpEL expression to select messages.
|
S |
selectorExpression(java.lang.String selectorExpression)
Configure a SpEL expression to select messages.
|
S |
session(javax.mail.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 |
userFlag(java.lang.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 .
|
_this, get, getId, getObject, getObjectType, id, isSingleton
protected final R extends org.springframework.integration.mail.AbstractMailReceiver receiver
protected final boolean externalReceiver
protected MailInboundChannelAdapterSpec(R receiver)
protected MailInboundChannelAdapterSpec(R receiver, boolean externalReceiver)
public S selectorExpression(java.lang.String selectorExpression)
MimeMessage
which should return a boolean
result (true means select the message).selectorExpression
- the selectorExpression.protected void assertReceiver()
public S selectorExpression(org.springframework.expression.Expression selectorExpression)
MimeMessage
which should return a boolean
result (true means select the message).selectorExpression
- the selectorExpression.public S selector(Function<javax.mail.internet.MimeMessage,java.lang.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(javax.mail.Session session)
Session
to use.session
- the session.AbstractMailReceiver.setSession(Session)
public S javaMailProperties(java.util.Properties javaMailProperties)
javaMailProperties
- the javaMailProperties.AbstractMailReceiver.setJavaMailProperties(Properties)
public S javaMailProperties(Consumer<PropertiesBuilder> configurer)
javaMailProperties
by invoking a Consumer
callback which
is invoked with a PropertiesBuilder
.configurer
- the configurer.AbstractMailReceiver.setJavaMailProperties(Properties)
public S javaMailAuthenticator(javax.mail.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(java.lang.String userFlag)
userFlag
- the flag.AbstractMailReceiver.setUserFlag(String)
public S headerMapper(org.springframework.integration.mapping.HeaderMapper<javax.mail.internet.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 java.util.Collection<java.lang.Object> getComponentsToRegister()
getComponentsToRegister
in interface ComponentsRegistration
public org.springframework.integration.mail.MailReceivingMessageSource doGet()
doGet
in class IntegrationComponentSpec<S extends MailInboundChannelAdapterSpec<S,R>,org.springframework.integration.mail.MailReceivingMessageSource>