Class RedisQueueInboundGateway

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ApplicationEventPublisherAware, Lifecycle, Phased, SmartLifecycle, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, ManageableSmartLifecycle, TrackableComponent

Since:
4.1
Author:
David Liu, Artem Bilan, Gary Russell, Matthias Jeschke
  • Field Details

    • DEFAULT_RECEIVE_TIMEOUT

      public static final long DEFAULT_RECEIVE_TIMEOUT
      See Also:
    • DEFAULT_RECOVERY_INTERVAL

      public static final long DEFAULT_RECOVERY_INTERVAL
      See Also:
  • Constructor Details

    • RedisQueueInboundGateway

      public RedisQueueInboundGateway(String queueName, RedisConnectionFactory connectionFactory)
      Parameters:
      queueName - Must not be an empty String
      connectionFactory - Must not be null
  • Method Details

    • setExtractPayload

      public void setExtractPayload(boolean extractPayload)
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface ApplicationEventPublisherAware
    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader beanClassLoader)
      Specified by:
      setBeanClassLoader in interface BeanClassLoaderAware
    • setSerializer

      public void setSerializer(RedisSerializer<?> serializer)
    • setReceiveTimeout

      public void setReceiveTimeout(long receiveTimeout)
      This timeout (milliseconds) is used when retrieving elements from the queue specified by boundListOperations.

      If the queue does contain elements, the data is retrieved immediately. However, if the queue is empty, the Redis connection is blocked until either an element can be retrieved from the queue or until the specified timeout passes.

      A timeout of zero can be used to block indefinitely. If not set explicitly the timeout value will default to 1000

      See also: https://redis.io/commands/brpop

      Parameters:
      receiveTimeout - Must be non-negative. Specified in milliseconds.
    • setTaskExecutor

      public void setTaskExecutor(Executor taskExecutor)
    • setRecoveryInterval

      public void setRecoveryInterval(long recoveryInterval)
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class MessagingGatewaySupport
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class MessagingGatewaySupport
    • doStart

      protected void doStart()
      Description copied from class: AbstractEndpoint
      Subclasses must implement this method with the start behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.
      Overrides:
      doStart in class MessagingGatewaySupport
    • doStop

      protected void doStop(Runnable callback)
      Description copied from class: AbstractEndpoint
      Stop the component and invoke callback.
      Overrides:
      doStop in class AbstractEndpoint
      Parameters:
      callback - the Runnable to invoke.
    • doStop

      protected void doStop()
      Description copied from class: AbstractEndpoint
      Subclasses must implement this method with the stop behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.
      Overrides:
      doStop in class MessagingGatewaySupport
    • isListening

      public boolean isListening()
    • getQueueSize

      @ManagedMetric public long getQueueSize()
      Returns the size of the Queue specified by boundListOperations. The queue is represented by a Redis list. If the queue does not exist 0 is returned. See also https://redis.io/commands/llen
      Returns:
      Size of the queue. Never negative.
    • clearQueue

      @ManagedOperation public void clearQueue()
      Clear the Redis Queue specified by boundListOperations.