Class RedisIndexedMessageStore

java.lang.Object
de.otto.synapse.messagestore.redis.RedisIndexedMessageStore
All Implemented Interfaces:
de.otto.synapse.messagestore.MessageStore, AutoCloseable

@Beta public class RedisIndexedMessageStore 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

    Constructors
    Constructor
    Description
    RedisIndexedMessageStore(String name, int batchSize, int maxMessages, long maxAge, de.otto.synapse.messagestore.Indexer indexer, org.springframework.data.redis.core.RedisTemplate<String,String> stringRedisTemplate)
     
    RedisIndexedMessageStore(String name, int batchSize, int maxMessages, long maxAge, de.otto.synapse.messagestore.Indexer indexer, 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 Type
    Method
    Description
    void
    add(de.otto.synapse.messagestore.MessageStoreEntry entry)
     
    void
     
     
    com.google.common.collect.ImmutableSet<de.otto.synapse.messagestore.Index>
     
    de.otto.synapse.channel.ChannelPosition
     
    long
     
    Stream<de.otto.synapse.messagestore.MessageStoreEntry>
     
    Stream<de.otto.synapse.messagestore.MessageStoreEntry>
    stream(de.otto.synapse.messagestore.Index index, String value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface de.otto.synapse.messagestore.MessageStore

    close, getLatestChannelPosition, isCompacting
  • Constructor Details

    • RedisIndexedMessageStore

      public RedisIndexedMessageStore(String name, int batchSize, int maxMessages, long maxAge, de.otto.synapse.messagestore.Indexer indexer, org.springframework.data.redis.core.RedisTemplate<String,String> stringRedisTemplate)
      Parameters:
      name - the name of the message store
      batchSize - the size of the batches used to fetch messages from Redis
      maxMessages - the maximum number of messages stored in the message store
      maxAge - maximum number of seconds after that a message will be evicted
      indexer - the Indexer used to index entities stored in the message store
      stringRedisTemplate - the RedisTemplate used to access Redis
    • RedisIndexedMessageStore

      public RedisIndexedMessageStore(String name, int batchSize, int maxMessages, long maxAge, de.otto.synapse.messagestore.Indexer indexer, 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 store
      batchSize - the size of the batches used to fetch messages from Redis
      maxMessages - the maximum number of messages stored in the message store
      maxAge - maximum number of seconds after that a message will be evicted
      indexer - the Indexer used to index entities stored in the message store
      stringRedisTemplate - the RedisTemplate used to access Redis
      messageEncoder - the encoder used to encode messages into the string-representation stored in Redis
      messageDecoder - 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:
      add in interface de.otto.synapse.messagestore.MessageStore
    • getChannelNames

      public Set<String> getChannelNames()
      Specified by:
      getChannelNames in interface de.otto.synapse.messagestore.MessageStore
    • getIndexes

      public com.google.common.collect.ImmutableSet<de.otto.synapse.messagestore.Index> getIndexes()
      Specified by:
      getIndexes in interface de.otto.synapse.messagestore.MessageStore
    • getLatestChannelPosition

      public de.otto.synapse.channel.ChannelPosition getLatestChannelPosition(String channelName)
      Specified by:
      getLatestChannelPosition in interface de.otto.synapse.messagestore.MessageStore
    • stream

      public Stream<de.otto.synapse.messagestore.MessageStoreEntry> stream()
      Specified by:
      stream in interface de.otto.synapse.messagestore.MessageStore
    • stream

      public Stream<de.otto.synapse.messagestore.MessageStoreEntry> stream(de.otto.synapse.messagestore.Index index, String value)
      Specified by:
      stream in interface de.otto.synapse.messagestore.MessageStore
    • size

      public long size()
      Specified by:
      size in interface de.otto.synapse.messagestore.MessageStore
    • clear

      public void clear()