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
ConstructorsConstructorDescriptionRedisChannelMessageStore(RedisConnectionFactory connectionFactory) Construct a message store that uses Java Serialization for messages. -
Method Summary
Modifier and TypeMethodDescriptionaddMessageToGroup(Object groupId, Message<?> message) Store a message with an association to a group id.voidprotected StringintgetMessageGroup(Object groupId) Return all Messages currently in the MessageStore that were stored usingBasicMessageGroupStore.addMessageToGroup(Object, Message)with this group id.intprotected MessageGroupFactoryprotected RedisTemplate<Object, Message<?>> intmessageGroupSize(Object groupId) Return the size of this MessageGroup.Message<?> pollMessageFromGroup(Object groupId) Poll Message from thisMessageGroup(in FIFO style if supported by the implementation) while also removing the polledMessage.voidremoveMessageGroup(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:BasicMessageGroupStoreReturn 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:BasicMessageGroupStorePoll 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
-