Class SimpleActiveIdleReceiveMessageAdvice

java.lang.Object
org.springframework.integration.aop.SimpleActiveIdleReceiveMessageAdvice
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, ReceiveMessageAdvice

public class SimpleActiveIdleReceiveMessageAdvice
extends java.lang.Object
implements ReceiveMessageAdvice
A simple advice that polls at one rate when messages exist and another when there are no messages.
Since:
5.3
See Also:
DynamicPeriodicTrigger
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleActiveIdleReceiveMessageAdvice​(DynamicPeriodicTrigger trigger)  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.messaging.Message<?> afterReceive​(org.springframework.messaging.Message<?> result, java.lang.Object source)
    Subclasses can take actions based on the result of the Joinpoint.proceed(); e.g.
    void setActivePollPeriod​(long activePollPeriod)
    Set the poll period when messages are returned.
    void setIdlePollPeriod​(long idlePollPeriod)
    Set the poll period when messages are not returned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.aop.ReceiveMessageAdvice

    beforeReceive, invoke
  • Constructor Details

  • Method Details

    • setIdlePollPeriod

      public void setIdlePollPeriod​(long idlePollPeriod)
      Set the poll period when messages are not returned. Defaults to the trigger's period.
      Parameters:
      idlePollPeriod - the period in milliseconds.
    • setActivePollPeriod

      public void setActivePollPeriod​(long activePollPeriod)
      Set the poll period when messages are returned. Defaults to the trigger's period.
      Parameters:
      activePollPeriod - the period in milliseconds.
    • afterReceive

      public org.springframework.messaging.Message<?> afterReceive​(org.springframework.messaging.Message<?> result, java.lang.Object source)
      Description copied from interface: ReceiveMessageAdvice
      Subclasses can take actions based on the result of the Joinpoint.proceed(); e.g. adjust the trigger. The message can also be replaced with a new one.
      Specified by:
      afterReceive in interface ReceiveMessageAdvice
      Parameters:
      result - the received message.
      source - the source of the message to receive.
      Returns:
      a message to continue to process the result, null to discard whatever the Joinpoint.proceed() returned.