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 MessageGroup
addMessageToGroup(Object groupId, Message<?> message)
Store a message with an association to a group id.void
afterPropertiesSet()
protected String
getBeanName()
int
getMessageCountForAllMessageGroups()
MessageGroup
getMessageGroup(Object groupId)
Return all Messages currently in the MessageStore that were stored usingBasicMessageGroupStore.addMessageToGroup(Object, Message)
with this group id.int
getMessageGroupCount()
protected MessageGroupFactory
getMessageGroupFactory()
protected RedisTemplate<Object,Message<?>>
getRedisTemplate()
int
messageGroupSize(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 polledMessage
void
removeMessageGroup(Object groupId)
Remove the message group with this id.void
setBeanClassLoader(ClassLoader classLoader)
void
setBeanName(String name)
void
setMessageGroupFactory(MessageGroupFactory messageGroupFactory)
Specify theMessageGroupFactory
to createMessageGroup
object where it is necessary.void
setValueSerializer(RedisSerializer<?> valueSerializer)
Use a different serializer (defaultJdkSerializationRedisSerializer
for 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:
setBeanClassLoader
in interfaceBeanClassLoaderAware
-
setValueSerializer
Use a different serializer (defaultJdkSerializationRedisSerializer
for theMessage
.- Parameters:
valueSerializer
- The value serializer.
-
setMessageGroupFactory
Specify theMessageGroupFactory
to createMessageGroup
object where it is necessary. Defaults toSimpleMessageGroupFactory
.- Parameters:
messageGroupFactory
- theMessageGroupFactory
to use.- Since:
- 4.3
-
getMessageGroupFactory
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
getBeanName
-
getRedisTemplate
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
messageGroupSize
Description copied from interface:BasicMessageGroupStore
Returns the size of this MessageGroup.- Specified by:
messageGroupSize
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- The size.
-
getMessageGroup
Description copied from interface:BasicMessageGroupStore
Return all Messages currently in the MessageStore that were stored usingBasicMessageGroupStore.addMessageToGroup(Object, Message)
with this group id.- Specified by:
getMessageGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- A group of messages, empty if none exists for this key.
-
addMessageToGroup
Description copied from interface:BasicMessageGroupStore
Store a message with an association to a group id. This can be used to group messages together.- Specified by:
addMessageToGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group id to store the message under.message
- A message.- Returns:
- The message group.
-
removeMessageGroup
Description copied from interface:BasicMessageGroupStore
Remove the message group with this id.- Specified by:
removeMessageGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The id of the group to remove.
-
pollMessageFromGroup
Description copied from interface:BasicMessageGroupStore
Polls Message from thisMessageGroup
(in FIFO style if supported by the implementation) while also removing the polledMessage
- Specified by:
pollMessageFromGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- The message.
-
getMessageCountForAllMessageGroups
-
getMessageGroupCount
-