public class RedisChannelMessageStore extends Object implements ChannelMessageStore, BeanNameAware, InitializingBean
ChannelMessageStore that uses a list to back a QueueChannel.
Requires setBeanName(String) which is used as part of the key.
| Constructor and Description |
|---|
RedisChannelMessageStore(RedisConnectionFactory connectionFactory)
Construct a message store that uses Java Serialization for messages.
|
| Modifier and Type | Method and 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 using
BasicMessageGroupStore.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 this
MessageGroup (in FIFO style if supported by the implementation)
while also removing the polled Message |
void |
removeMessageGroup(Object groupId)
Remove the message group with this id.
|
void |
setBeanName(String name) |
void |
setMessageGroupFactory(MessageGroupFactory messageGroupFactory)
Specify the
MessageGroupFactory to create MessageGroup object where
it is necessary. |
void |
setValueSerializer(RedisSerializer<?> valueSerializer)
Use a different serializer (default
JdkSerializationRedisSerializer for
the Message. |
public RedisChannelMessageStore(RedisConnectionFactory connectionFactory)
connectionFactory - The redis connection factory.public void setValueSerializer(RedisSerializer<?> valueSerializer)
JdkSerializationRedisSerializer for
the Message.valueSerializer - The value serializer.public void setMessageGroupFactory(MessageGroupFactory messageGroupFactory)
MessageGroupFactory to create MessageGroup object where
it is necessary.
Defaults to SimpleMessageGroupFactory.messageGroupFactory - the MessageGroupFactory to use.protected MessageGroupFactory getMessageGroupFactory()
public void setBeanName(String name)
setBeanName in interface BeanNameAwareprotected String getBeanName()
protected RedisTemplate<Object,Message<?>> getRedisTemplate()
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBean@ManagedAttribute public int messageGroupSize(Object groupId)
BasicMessageGroupStoremessageGroupSize in interface BasicMessageGroupStoregroupId - The group identifier.public MessageGroup getMessageGroup(Object groupId)
BasicMessageGroupStoreBasicMessageGroupStore.addMessageToGroup(Object, Message) with this group id.getMessageGroup in interface BasicMessageGroupStoregroupId - The group identifier.public MessageGroup addMessageToGroup(Object groupId, Message<?> message)
BasicMessageGroupStoreaddMessageToGroup in interface BasicMessageGroupStoregroupId - The group id to store the message under.message - A message.public void removeMessageGroup(Object groupId)
BasicMessageGroupStoreremoveMessageGroup in interface BasicMessageGroupStoregroupId - The id of the group to remove.public Message<?> pollMessageFromGroup(Object groupId)
BasicMessageGroupStoreMessageGroup (in FIFO style if supported by the implementation)
while also removing the polled MessagepollMessageFromGroup in interface BasicMessageGroupStoregroupId - The group identifier.@ManagedAttribute public int getMessageCountForAllMessageGroups()
@ManagedAttribute public int getMessageGroupCount()