Class StreamReadOptions

java.lang.Object
org.springframework.data.redis.connection.stream.StreamReadOptions

public class StreamReadOptions extends Object
Options for reading messages from a Redis Stream.
Author:
Mark Paluch, Christoph Strobl, Kaizhou Zhang
  • Method Details

    • empty

      public static StreamReadOptions empty()
      Creates an empty StreamReadOptions instance.
      Returns:
      an empty StreamReadOptions instance.
    • noack

      public StreamReadOptions noack()
      Enable auto-acknowledgement by setting the NOACK flag when reading in the context of a consumer group. This method is an alias for autoAcknowledge() for readability reasons.
      Returns:
      StreamReadOptions with noack applied.
    • autoAcknowledge

      public StreamReadOptions autoAcknowledge()
      Enable auto-acknowledgement by setting the NOACK flag when reading in the context of a consumer group. This method is an alias for noack() for readability reasons.
      Returns:
      new instance of StreamReadOptions with noack applied.
      Since:
      2.3
    • block

      public StreamReadOptions block(Duration timeout)
      Use a blocking read and supply the timeout after which the call will terminate if no message was read.
      Parameters:
      timeout - the timeout for the blocking read, must not be null or negative.
      Returns:
      new instance of StreamReadOptions with block applied.
    • count

      public StreamReadOptions count(long count)
      Limit the number of messages returned per stream.
      Parameters:
      count - the maximum number of messages to read.
      Returns:
      StreamReadOptions with count applied.
    • isBlocking

      public boolean isBlocking()
      Returns:
      true if the arguments indicate a blocking read.
      Since:
      2.3
    • getBlock

      @Nullable public Long getBlock()
    • getCount

      @Nullable public Long getCount()
    • isNoack

      public boolean isNoack()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object