Class RedisChannelMessageStore
java.lang.Object
org.springframework.integration.redis.store.RedisChannelMessageStore
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanNameAware,InitializingBean,BasicMessageGroupStore,ChannelMessageStore
- Direct Known Subclasses:
RedisChannelPriorityMessageStore
public class RedisChannelMessageStore extends Object implements ChannelMessageStore, BeanNameAware, InitializingBean, BeanClassLoaderAware
Specialized Redis
ChannelMessageStore that uses a list to back a QueueChannel.
Requires setBeanName(String) which is used as part of the key.
- Since:
- 4.0
- Author:
- Gary Russell, Artem Bilan
-
Constructor Summary
Constructors Constructor Description RedisChannelMessageStore(RedisConnectionFactory connectionFactory)Construct a message store that uses Java Serialization for messages. -
Method Summary
Modifier and Type Method Description MessageGroupaddMessageToGroup(Object groupId, Message<?> message)Store a message with an association to a group id.voidafterPropertiesSet()protected StringgetBeanName()intgetMessageCountForAllMessageGroups()MessageGroupgetMessageGroup(Object groupId)Return all Messages currently in the MessageStore that were stored usingBasicMessageGroupStore.addMessageToGroup(Object, Message)with this group id.intgetMessageGroupCount()protected MessageGroupFactorygetMessageGroupFactory()protected RedisTemplate<Object,Message<?>>getRedisTemplate()intmessageGroupSize(Object groupId)Returns the size of this MessageGroup.Message<?>pollMessageFromGroup(Object groupId)Polls Message from thisMessageGroup(in FIFO style if supported by the implementation) while also removing the polledMessagevoidremoveMessageGroup(Object groupId)Remove the message group with this id.voidsetBeanClassLoader(ClassLoader classLoader)voidsetBeanName(String name)voidsetMessageGroupFactory(MessageGroupFactory messageGroupFactory)Specify theMessageGroupFactoryto createMessageGroupobject where it is necessary.voidsetValueSerializer(RedisSerializer<?> valueSerializer)Use a different serializer (defaultJdkSerializationRedisSerializerfor theMessage.
-
Constructor Details
-
RedisChannelMessageStore
Construct a message store that uses Java Serialization for messages.- Parameters:
connectionFactory- The redis connection factory.
-
-
Method Details
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
setValueSerializer
Use a different serializer (defaultJdkSerializationRedisSerializerfor theMessage.- Parameters:
valueSerializer- The value serializer.
-
setMessageGroupFactory
Specify theMessageGroupFactoryto createMessageGroupobject where it is necessary. Defaults toSimpleMessageGroupFactory.- Parameters:
messageGroupFactory- theMessageGroupFactoryto use.- Since:
- 4.3
-
getMessageGroupFactory
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
getBeanName
-
getRedisTemplate
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
messageGroupSize
Description copied from interface:BasicMessageGroupStoreReturns the size of this MessageGroup.- Specified by:
messageGroupSizein interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- The size.
-
getMessageGroup
Description copied from interface:BasicMessageGroupStoreReturn all Messages currently in the MessageStore that were stored usingBasicMessageGroupStore.addMessageToGroup(Object, Message)with this group id.- Specified by:
getMessageGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- A group of messages, empty if none exists for this key.
-
addMessageToGroup
Description copied from interface:BasicMessageGroupStoreStore a message with an association to a group id. This can be used to group messages together.- Specified by:
addMessageToGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The group id to store the message under.message- A message.- Returns:
- The message group.
-
removeMessageGroup
Description copied from interface:BasicMessageGroupStoreRemove the message group with this id.- Specified by:
removeMessageGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The id of the group to remove.
-
pollMessageFromGroup
Description copied from interface:BasicMessageGroupStorePolls Message from thisMessageGroup(in FIFO style if supported by the implementation) while also removing the polledMessage- Specified by:
pollMessageFromGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- The message.
-
getMessageCountForAllMessageGroups
-
getMessageGroupCount
-