Class RedisRingBufferMessageStore
java.lang.Object
de.otto.synapse.messagestore.redis.RedisRingBufferMessageStore
- All Implemented Interfaces:
de.otto.synapse.messagestore.MessageStore,AutoCloseable
@Beta
public class RedisRingBufferMessageStore
extends Object
implements de.otto.synapse.messagestore.MessageStore
Redis-based implementation of a WritableMessageStore.
The store can be configured like a ring-buffer to only store the latest N messages.
-
Constructor Summary
ConstructorsConstructorDescriptionRedisRingBufferMessageStore(String name, int batchSize, int ringBufferSize, org.springframework.data.redis.core.RedisTemplate<String, String> stringRedisTemplate) RedisRingBufferMessageStore(String name, int batchSize, int ringBufferSize, org.springframework.data.redis.core.RedisTemplate<String, String> stringRedisTemplate, de.otto.synapse.translator.Encoder<String> messageEncoder, de.otto.synapse.translator.Decoder<String> messageDecoder) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(de.otto.synapse.messagestore.MessageStoreEntry entry) voidclear()voidclose()com.google.common.collect.ImmutableSet<de.otto.synapse.messagestore.Index>de.otto.synapse.channel.ChannelPositiongetLatestChannelPosition(String channelName) longsize()Stream<de.otto.synapse.messagestore.MessageStoreEntry>stream()Stream<de.otto.synapse.messagestore.MessageStoreEntry>Deprecated.Unsupported operation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.otto.synapse.messagestore.MessageStore
getLatestChannelPosition, isCompacting
-
Constructor Details
-
RedisRingBufferMessageStore
public RedisRingBufferMessageStore(String name, int batchSize, int ringBufferSize, org.springframework.data.redis.core.RedisTemplate<String, String> stringRedisTemplate) - Parameters:
name- the name of the message storebatchSize- the size of the batches used to fetch messages from RedisringBufferSize- the maximum number of messages stored in the ring-bufferstringRedisTemplate- the RedisTemplate used to access Redis
-
RedisRingBufferMessageStore
public RedisRingBufferMessageStore(String name, int batchSize, int ringBufferSize, org.springframework.data.redis.core.RedisTemplate<String, String> stringRedisTemplate, de.otto.synapse.translator.Encoder<String> messageEncoder, de.otto.synapse.translator.Decoder<String> messageDecoder) - Parameters:
name- the name of the message storebatchSize- the size of the batches used to fetch messages from RedisringBufferSize- the maximum number of messages stored in the ring-bufferstringRedisTemplate- the RedisTemplate used to access RedismessageEncoder- the encoder used to encode messages into the string-representation stored in RedismessageDecoder- the decoder used to decode messages from the string-representation stored in Redis
-
-
Method Details
-
add
public void add(de.otto.synapse.messagestore.MessageStoreEntry entry) - Specified by:
addin interfacede.otto.synapse.messagestore.MessageStore
-
getChannelNames
- Specified by:
getChannelNamesin interfacede.otto.synapse.messagestore.MessageStore
-
getIndexes
public com.google.common.collect.ImmutableSet<de.otto.synapse.messagestore.Index> getIndexes()- Specified by:
getIndexesin interfacede.otto.synapse.messagestore.MessageStore
-
getLatestChannelPosition
- Specified by:
getLatestChannelPositionin interfacede.otto.synapse.messagestore.MessageStore
-
stream
- Specified by:
streamin interfacede.otto.synapse.messagestore.MessageStore
-
stream
public Stream<de.otto.synapse.messagestore.MessageStoreEntry> stream(de.otto.synapse.messagestore.Index index, String value) Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the message store unmodified.- Specified by:
streamin interfacede.otto.synapse.messagestore.MessageStore- Throws:
UnsupportedOperationException- always
-
size
public long size()- Specified by:
sizein interfacede.otto.synapse.messagestore.MessageStore
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacede.otto.synapse.messagestore.MessageStore
-
clear
public void clear()
-