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 targetMailInboundChannelAdapterSpecimplementation type.R- the targetAbstractMailReceiverimplementation 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
FieldsFields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, targetFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMailInboundChannelAdapterSpec(R receiver) protectedMailInboundChannelAdapterSpec(R receiver, boolean externalReceiver) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidautoCloseFolder(boolean autoCloseFolder) When configured tofalse, the folder is not closed automatically after a fetch.doGet()embeddedPartsAsBytes(boolean embeddedPartsAsBytes) flaggedAsFallback(boolean flaggedAsFallback) Whether theFlags.Flag.FLAGGEDflag should be added to the message when\Recentor 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 theMimeMessagecontent.javaMailAuthenticator(Authenticator javaMailAuthenticator) The Java MailAuthenticator.javaMailProperties(Consumer<PropertiesBuilder> configurer) Configure thejavaMailPropertiesby invoking aConsumercallback 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 aFunctionto 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 MailSessionto 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
messageHeadersMethods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, getId, getObject, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 aMimeMessagewhich 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 aMimeMessagewhich should return a boolean result (true means select the message).- Parameters:
selectorExpression- the selectorExpression.- Returns:
- the spec.
-
selector
Configure aFunctionto select messages. The argument for the function is aMimeMessage;applyreturns a boolean result (true means select the message).- Parameters:
selectorFunction- the selectorFunction.- Returns:
- the spec.
- See Also:
-
session
Provide the Java MailSessionto 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 thejavaMailPropertiesby invoking aConsumercallback 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 theMimeMessagecontent.- Parameters:
headerMapper- the header mapper.- Returns:
- the spec.
- See Also:
-
embeddedPartsAsBytes
When a header mapper is provided determine whether an embeddedPart(e.gMessageorMultipartcontent 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_RESOURCEheader from the message produced by this channel adapter.- Parameters:
autoCloseFolder- set tofalseto keep folder opened.- Returns:
- the spec.
- Since:
- 5.2
- See Also:
-
flaggedAsFallback
Whether theFlags.Flag.FLAGGEDflag should be added to the message when\Recentor user flags are not supported on mail server.- Parameters:
flaggedAsFallback-falseto not addFlags.Flag.FLAGGEDflag as a fallback.- Returns:
- the spec.
- Since:
- 6.4
-
getComponentsToRegister
- Specified by:
getComponentsToRegisterin interfaceComponentsRegistration
-
doGet
- Overrides:
doGetin classIntegrationComponentSpec<S extends MailInboundChannelAdapterSpec<S,R>, MailReceivingMessageSource>
-