Class RedisMessageStore
java.lang.Object
org.springframework.integration.store.AbstractBatchingMessageGroupStore
org.springframework.integration.store.AbstractMessageGroupStore
org.springframework.integration.store.AbstractKeyValueMessageStore
org.springframework.integration.redis.store.RedisMessageStore
- All Implemented Interfaces:
Iterable<MessageGroup>, Aware, BeanClassLoaderAware, IntegrationPattern, BasicMessageGroupStore, MessageGroupStore, MessageStore
Redis implementation of the key/value style
MessageStore and
MessageGroupStore- Since:
- 2.1
- Author:
- Oleg Zhurakousky, Gary Russell, Artem Bilan, Michal Domagala, Yordan Tsintsov
-
Nested Class Summary
Nested classes/interfaces inherited from interface MessageGroupStore
MessageGroupStore.MessageGroupCallback -
Field Summary
Fields inherited from class AbstractKeyValueMessageStore
MESSAGE_GROUP_KEY_PREFIX, MESSAGE_KEY_PREFIXFields inherited from class AbstractMessageGroupStore
INTERRUPTED_WHILE_OBTAINING_LOCK, logger -
Constructor Summary
ConstructorsConstructorDescriptionRedisMessageStore(RedisConnectionFactory connectionFactory) ConstructRedisMessageStorebased on the providedRedisConnectionFactoryand default empty prefix.RedisMessageStore(RedisConnectionFactory connectionFactory, String prefix) ConstructRedisMessageStorebased on the providedRedisConnectionFactoryand prefix. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<?> doListKeys(String keyPattern) protected @Nullable Objectprotected voiddoRemoveAll(Collection<Object> ids) protected @Nullable ObjectdoRetrieve(Object id) protected voidprotected voiddoStoreIfAbsent(Object id, Object objectToStore) voidsetBeanClassLoader(ClassLoader classLoader) voidsetUseUnlink(boolean useUnlink) Configure the deletion strategy used when removing messages from the store.voidsetValueSerializer(RedisSerializer<?> valueSerializer) Methods inherited from class AbstractKeyValueMessageStore
addMessage, doAddMessage, doAddMessage, doAddMessagesToGroup, doCompleteGroup, doPollMessageFromGroup, doRemoveMessageFromGroupById, doRemoveMessageGroup, doRemoveMessagesFromGroup, doSetGroupCondition, doSetLastReleasedSequenceNumberForGroup, getGroupMetadata, getGroupPrefix, getMessage, getMessageCount, getMessageFromGroup, getMessageGroup, getMessageMetadata, getMessagePrefix, getMessagesForGroup, getOneMessageFromGroup, iterator, messageGroupSize, removeMessage, streamMessagesForGroupMethods inherited from class AbstractMessageGroupStore
addMessagesToGroup, addMessageToGroup, completeGroup, copy, executeLocked, executeLocked, expireMessageGroups, getLockRegistry, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, pollMessageFromGroup, registerMessageGroupExpiryCallback, removeMessageFromGroupById, removeMessageGroup, removeMessagesFromGroup, removeMessagesFromGroup, setExpiryCallbacks, setGroupCondition, setLastReleasedSequenceNumberForGroup, setLazyLoadMessageGroups, setLockRegistry, setTimeoutOnIdleMethods inherited from class AbstractBatchingMessageGroupStore
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface MessageStore
getIntegrationPatternType
-
Constructor Details
-
RedisMessageStore
ConstructRedisMessageStorebased on the providedRedisConnectionFactoryand default empty prefix.- Parameters:
connectionFactory- the RedisConnectionFactory to use
-
RedisMessageStore
ConstructRedisMessageStorebased on the providedRedisConnectionFactoryand prefix.- Parameters:
connectionFactory- the RedisConnectionFactory to useprefix- the key prefix to use, allowing the same broker to be used for multiple stores.- Since:
- 4.3.12
- See Also:
-
-
Method Details
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
setValueSerializer
-
setUseUnlink
public void setUseUnlink(boolean useUnlink) Configure the deletion strategy used when removing messages from the store.By default (
false), the store uses the RedisGETDELcommand (since Redis 6.2).When set to
true, the store usesGET+UNLINK.Consider enabling this option when:
- Stored messages are large, and blocking deletes cause noticeable Redis latency
- Atomicity between get and delete is not required for your use case
Note: For small values, Redis may perform synchronous deletion even with
UNLINK, so the benefit is primarily for larger payloads.- Parameters:
useUnlink- param to set deletion strategy.- Since:
- 7.1
- See Also:
-
doRetrieve
- Specified by:
doRetrievein classAbstractKeyValueMessageStore
-
doStore
- Specified by:
doStorein classAbstractKeyValueMessageStore
-
doStoreIfAbsent
- Specified by:
doStoreIfAbsentin classAbstractKeyValueMessageStore
-
doRemove
- Specified by:
doRemovein classAbstractKeyValueMessageStore
-
doRemoveAll
- Specified by:
doRemoveAllin classAbstractKeyValueMessageStore
-
doListKeys
- Specified by:
doListKeysin classAbstractKeyValueMessageStore
-