Class DelayerEndpointSpec

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
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<reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,​DelayHandler>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, ComponentsRegistration

public class DelayerEndpointSpec
extends ConsumerEndpointSpec<DelayerEndpointSpec,​DelayHandler>
Since:
5.0
  • Constructor Details

  • Method Details

    • defaultDelay

      public DelayerEndpointSpec defaultDelay​(long defaultDelay)
      Parameters:
      defaultDelay - the defaultDelay.
      Returns:
      the endpoint spec.
      See Also:
      DelayHandler.setDefaultDelay(long)
    • ignoreExpressionFailures

      public DelayerEndpointSpec ignoreExpressionFailures​(boolean ignoreExpressionFailures)
      Parameters:
      ignoreExpressionFailures - the ignoreExpressionFailures.
      Returns:
      the endpoint spec.
      See Also:
      DelayHandler.setIgnoreExpressionFailures(boolean)
    • messageStore

      public DelayerEndpointSpec messageStore​(MessageGroupStore messageStore)
      Parameters:
      messageStore - the message store.
      Returns:
      the endpoint spec.
    • delayedAdvice

      public DelayerEndpointSpec delayedAdvice​(org.aopalliance.aop.Advice... advice)
      Configure a list of Advice objects that will be applied, in nested order, when delayed messages are sent.
      Parameters:
      advice - the advice chain.
      Returns:
      the endpoint spec.
    • delayExpression

      public DelayerEndpointSpec delayExpression​(org.springframework.expression.Expression delayExpression)
    • delayExpression

      public DelayerEndpointSpec delayExpression​(java.lang.String delayExpression)
    • delayedMessageErrorChannel

      public DelayerEndpointSpec delayedMessageErrorChannel​(org.springframework.messaging.MessageChannel channel)
      Set a message channel to which an ErrorMessage will be sent if sending the released message fails. If the error flow returns normally, the release is complete. If the error flow throws an exception, the release will be re-attempted. If there is a transaction advice on the release task, the error flow is called within the transaction.
      Parameters:
      channel - the channel.
      Returns:
      the endpoint spec.
      Since:
      5.0.8
      See Also:
      maxAttempts(int), retryDelay(long)
    • delayedMessageErrorChannel

      public DelayerEndpointSpec delayedMessageErrorChannel​(java.lang.String channel)
      Set a message channel name to which an ErrorMessage will be sent if sending the released message fails. If the error flow returns normally, the release is complete. If the error flow throws an exception, the release will be re-attempted. If there is a transaction advice on the release task, the error flow is called within the transaction.
      Parameters:
      channel - the channel name.
      Returns:
      the endpoint spec.
      Since:
      5.0.8
      See Also:
      maxAttempts(int), retryDelay(long)
    • maxAttempts

      public DelayerEndpointSpec maxAttempts​(int maxAttempts)
      Set the maximum number of release attempts for when message release fails. Default 5.
      Parameters:
      maxAttempts - the max attempts.
      Returns:
      the endpoint spec.
      Since:
      5.0.8
      See Also:
      retryDelay(long)
    • retryDelay

      public DelayerEndpointSpec retryDelay​(long retryDelay)
      Set an additional delay to apply when retrying after a release failure. Default 1000L.
      Parameters:
      retryDelay - the retry delay.
      Returns:
      the endpoint spec.
      Since:
      5.0.8
      See Also:
      maxAttempts(int)
    • transactionalRelease

      public DelayerEndpointSpec transactionalRelease()
      Specify a TransactionInterceptor Advice with default TransactionManager and DefaultTransactionAttribute for the MessageHandler.
      Returns:
      the spec.
      Since:
      5.0.8
    • transactionalRelease

      public DelayerEndpointSpec transactionalRelease​(org.springframework.transaction.interceptor.TransactionInterceptor transactionInterceptor)
      Specify a TransactionInterceptor Advice for the MessageHandler.
      Parameters:
      transactionInterceptor - the TransactionInterceptor to use.
      Returns:
      the spec.
      Since:
      5.0.8
      See Also:
      TransactionInterceptorBuilder
    • transactionalRelease

      public DelayerEndpointSpec transactionalRelease​(org.springframework.transaction.TransactionManager transactionManager)
      Specify a TransactionInterceptor Advice with the provided TransactionManager and default DefaultTransactionAttribute for the MessageHandler.
      Parameters:
      transactionManager - the TransactionManager to use.
      Returns:
      the spec.
      Since:
      5.2.5
    • delayFunction

      public <P> DelayerEndpointSpec delayFunction​(java.util.function.Function<org.springframework.messaging.Message<P>,​java.lang.Object> delayFunction)
      Specify the function to determine delay value against Message. Typically used with a Java 8 Lambda expression:
       
        .<Foo>delay("delayer", m -> m.getPayload().getDate(),
                  c -> c.advice(this.delayedAdvice).messageStore(this.messageStore()))
       
       
      Type Parameters:
      P - the payload type.
      Parameters:
      delayFunction - the Function to determine delay.
      Returns:
      the endpoint spec.