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:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<ImapIdleChannelAdapter>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.dsl.ComponentsRegistration

public class ImapIdleChannelAdapterSpec extends org.springframework.integration.dsl.MessageProducerSpec<ImapIdleChannelAdapterSpec,ImapIdleChannelAdapter> implements org.springframework.integration.dsl.ComponentsRegistration
A MessageProducerSpec for a ImapIdleChannelAdapter.
Since:
5.0
  • Field Details

    • receiver

      protected final ImapMailReceiver receiver
    • componentsToRegister

      protected final Map<Object,String> componentsToRegister
    • externalReceiver

      protected final boolean externalReceiver
  • Constructor Details

    • ImapIdleChannelAdapterSpec

      protected ImapIdleChannelAdapterSpec(ImapMailReceiver receiver)
    • ImapIdleChannelAdapterSpec

      protected ImapIdleChannelAdapterSpec(ImapMailReceiver receiver, boolean externalReceiver)
  • Method Details

    • selectorExpression

      public ImapIdleChannelAdapterSpec selectorExpression(String selectorExpression)
      Configure a SpEL expression to select messages. The root object for the expression evaluation is a MimeMessage which should return a boolean result (true means select the message).
      Parameters:
      selectorExpression - the selectorExpression.
      Returns:
      the spec.
    • selectorExpression

      public ImapIdleChannelAdapterSpec selectorExpression(org.springframework.expression.Expression selectorExpression)
      Configure an Expression to select messages. The root object for the expression evaluation is a MimeMessage which should return a boolean result (true means select the message).
      Parameters:
      selectorExpression - the selectorExpression.
      Returns:
      the spec.
    • selector

      public ImapIdleChannelAdapterSpec selector(Function<jakarta.mail.internet.MimeMessage,Boolean> selectorFunction)
      Configure a Function to select messages. The argument for the function is a MimeMessage; apply returns a boolean result (true means select the message).
      Parameters:
      selectorFunction - the selectorFunction.
      Returns:
      the spec.
      See Also:
      • FunctionExpression
    • session

      public ImapIdleChannelAdapterSpec session(jakarta.mail.Session session)
      A Java Mail Session to use.
      Parameters:
      session - the session.
      Returns:
      the spec.
      See Also:
    • javaMailProperties

      public ImapIdleChannelAdapterSpec javaMailProperties(Properties javaMailProperties)
      Parameters:
      javaMailProperties - the javaMailProperties.
      Returns:
      the spec.
      See Also:
    • javaMailProperties

      public ImapIdleChannelAdapterSpec javaMailProperties(Consumer<org.springframework.integration.support.PropertiesBuilder> configurer)
      Configure the javaMailProperties by invoking a Consumer callback which is invoked with a PropertiesBuilder.
      Parameters:
      configurer - the configurer.
      Returns:
      the spec.
      See Also:
    • javaMailAuthenticator

      public ImapIdleChannelAdapterSpec javaMailAuthenticator(jakarta.mail.Authenticator javaMailAuthenticator)
      Parameters:
      javaMailAuthenticator - the javaMailAuthenticator.
      Returns:
      the spec.
      See Also:
    • maxFetchSize

      public ImapIdleChannelAdapterSpec maxFetchSize(int maxFetchSize)
      Parameters:
      maxFetchSize - the maxFetchSize.
      Returns:
      the spec.
      See Also:
    • shouldDeleteMessages

      public ImapIdleChannelAdapterSpec shouldDeleteMessages(boolean shouldDeleteMessages)
      Parameters:
      shouldDeleteMessages - the shouldDeleteMessages.
      Returns:
      the spec.
      See Also:
    • searchTermStrategy

      public ImapIdleChannelAdapterSpec searchTermStrategy(SearchTermStrategy searchTermStrategy)
      Parameters:
      searchTermStrategy - the searchTermStrategy.
      Returns:
      the spec.
      See Also:
    • shouldMarkMessagesAsRead

      public ImapIdleChannelAdapterSpec shouldMarkMessagesAsRead(boolean shouldMarkMessagesAsRead)
      Parameters:
      shouldMarkMessagesAsRead - the shouldMarkMessagesAsRead.
      Returns:
      the spec.
      See Also:
    • userFlag

      public 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".
      Parameters:
      userFlag - the flag.
      Returns:
      the spec.
      See Also:
    • headerMapper

      public ImapIdleChannelAdapterSpec headerMapper(org.springframework.integration.mapping.HeaderMapper<jakarta.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.
      Parameters:
      headerMapper - the header mapper.
      Returns:
      the spec.
      See Also:
    • embeddedPartsAsBytes

      public ImapIdleChannelAdapterSpec 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. 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.

      Parameters:
      embeddedPartsAsBytes - the embeddedPartsAsBytes to set.
      Returns:
      the spec.
      See Also:
    • autoCloseFolder

      public ImapIdleChannelAdapterSpec autoCloseFolder(boolean autoCloseFolder)
      When configured to 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.
      Parameters:
      autoCloseFolder - set to false to keep folder opened.
      Returns:
      the spec.
      Since:
      5.2
      See Also:
    • transactionSynchronizationFactory

      public ImapIdleChannelAdapterSpec transactionSynchronizationFactory(org.springframework.integration.transaction.TransactionSynchronizationFactory transactionSynchronizationFactory)
      Configure a TransactionSynchronizationFactory. Usually used to synchronize message deletion with some external transaction manager.
      Parameters:
      transactionSynchronizationFactory - the transactionSynchronizationFactory.
      Returns:
      the spec.
    • adviceChain

      public ImapIdleChannelAdapterSpec adviceChain(org.aopalliance.aop.Advice... adviceChain)
      Configure a chain of Advice objects for message delivery, applied to the downstream flow.
      Parameters:
      adviceChain - the advice chain.
      Returns:
      the spec.
    • transactional

      public ImapIdleChannelAdapterSpec transactional(org.springframework.transaction.TransactionManager transactionManager)
      Specify a TransactionInterceptor Advice with the provided TransactionManager and default DefaultTransactionAttribute for the downstream flow.
      Parameters:
      transactionManager - the TransactionManager to use.
      Returns:
      the spec.
      Since:
      5.2.5
    • transactional

      public ImapIdleChannelAdapterSpec transactional(org.springframework.transaction.interceptor.TransactionInterceptor transactionInterceptor)
      Specify a TransactionInterceptor Advice for the downstream flow.
      Parameters:
      transactionInterceptor - the TransactionInterceptor to use.
      Returns:
      the spec.
      See Also:
      • TransactionInterceptorBuilder
    • transactional

      public ImapIdleChannelAdapterSpec transactional()
      Specify a TransactionInterceptor Advice with default PlatformTransactionManager and DefaultTransactionAttribute for the downstream flow.
      Returns:
      the spec.
    • sendingTaskExecutor

      public ImapIdleChannelAdapterSpec sendingTaskExecutor(Executor sendingTaskExecutor)
      Specify a task executor to be used to send messages to the downstream flow.
      Parameters:
      sendingTaskExecutor - the sendingTaskExecutor.
      Returns:
      the spec.
      See Also:
    • shouldReconnectAutomatically

      public ImapIdleChannelAdapterSpec shouldReconnectAutomatically(boolean shouldReconnectAutomatically)
      Parameters:
      shouldReconnectAutomatically - the shouldReconnectAutomatically.
      Returns:
      the spec.
      See Also:
    • cancelIdleInterval

      public ImapIdleChannelAdapterSpec cancelIdleInterval(long interval)
      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:
    • reconnectDelay

      public ImapIdleChannelAdapterSpec reconnectDelay(long reconnectDelay)
      The time between connection attempts in milliseconds (default 10 seconds).
      Parameters:
      reconnectDelay - the reconnectDelay to set.
      Returns:
      the spec.
      Since:
      6.0
    • simpleContent

      public ImapIdleChannelAdapterSpec simpleContent(boolean simpleContent)
      Determine how the content is rendered.
      Parameters:
      simpleContent - true for simple content.
      Returns:
      the spec.
      Since:
      5.5
      See Also:
    • getComponentsToRegister

      public Map<Object,String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface org.springframework.integration.dsl.ComponentsRegistration