Class RedisStoreMessageSource

java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<org.springframework.data.redis.support.collections.RedisStore>
org.springframework.integration.redis.inbound.RedisStoreMessageSource
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.integration.core.MessageSource<org.springframework.data.redis.support.collections.RedisStore>, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationInboundManagement, org.springframework.integration.support.management.IntegrationManagement

public class RedisStoreMessageSource
extends org.springframework.integration.endpoint.AbstractMessageSource<org.springframework.data.redis.support.collections.RedisStore>
Inbound channel adapter which returns a Message representing a view into a Redis store. The type of store depends on the collectionType attribute. Default is LIST. This adapter supports 5 types of collections identified by RedisCollectionFactoryBean.CollectionType
Since:
2.2
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
  • Constructor Summary

    Constructors 
    Constructor Description
    RedisStoreMessageSource​(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, org.springframework.expression.Expression keyExpression)
    Creates an instance with the provided RedisConnectionFactory and SpEL expression which should resolve to a 'key' name of the collection to be used.
    RedisStoreMessageSource​(org.springframework.data.redis.core.RedisTemplate<java.lang.String,​?> redisTemplate, org.springframework.expression.Expression keyExpression)
    Creates an instance with the provided RedisTemplate and SpEL expression which should resolve to a 'key' name of the collection to be used.
  • Method Summary

    Modifier and Type Method Description
    void afterCommit​(java.lang.Object object)  
    void afterRollback​(java.lang.Object object)  
    protected org.springframework.data.redis.support.collections.RedisStore doReceive()
    Returns a Message with the view into a RedisStore identified by keyExpression
    java.lang.String getComponentType()  
    org.springframework.data.redis.support.collections.RedisStore getResource()  
    protected void onInit()  
    void setCollectionType​(org.springframework.data.redis.support.collections.RedisCollectionFactoryBean.CollectionType collectionType)  

    Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource

    buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedType

    Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator

    afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService

    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.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.integration.core.MessageSource

    getIntegrationPatternType
  • Constructor Details

    • RedisStoreMessageSource

      public RedisStoreMessageSource​(org.springframework.data.redis.core.RedisTemplate<java.lang.String,​?> redisTemplate, org.springframework.expression.Expression keyExpression)
      Creates an instance with the provided RedisTemplate and SpEL expression which should resolve to a 'key' name of the collection to be used. It assumes that RedisTemplate is fully initialized and ready to be used. The 'keyExpression' will be evaluated on every call to the AbstractMessageSource.receive() method.
      Parameters:
      redisTemplate - The Redis template.
      keyExpression - The key expression.
    • RedisStoreMessageSource

      public RedisStoreMessageSource​(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, org.springframework.expression.Expression keyExpression)
      Creates an instance with the provided RedisConnectionFactory and SpEL expression which should resolve to a 'key' name of the collection to be used. It will create and initialize an instance of StringRedisTemplate that uses StringRedisSerializer for all serialization. The 'keyExpression' will be evaluated on every call to the AbstractMessageSource.receive() method.
      Parameters:
      connectionFactory - The connection factory.
      keyExpression - The key expression.
  • Method Details

    • setCollectionType

      public void setCollectionType​(org.springframework.data.redis.support.collections.RedisCollectionFactoryBean.CollectionType collectionType)
    • onInit

      protected void onInit()
      Overrides:
      onInit in class org.springframework.integration.util.AbstractExpressionEvaluator
    • doReceive

      protected org.springframework.data.redis.support.collections.RedisStore doReceive()
      Returns a Message with the view into a RedisStore identified by keyExpression
      Specified by:
      doReceive in class org.springframework.integration.endpoint.AbstractMessageSource<org.springframework.data.redis.support.collections.RedisStore>
    • getComponentType

      public java.lang.String getComponentType()
    • getResource

      public org.springframework.data.redis.support.collections.RedisStore getResource()
    • afterCommit

      public void afterCommit​(java.lang.Object object)
    • afterRollback

      public void afterRollback​(java.lang.Object object)