Interface BoundStreamOperations<K,HK,HV>


public interface BoundStreamOperations<K,HK,HV>
Redis stream specific operations bound to a certain key.
Since:
2.2
Author:
Mark Paluch, Christoph Strobl, Dengliming
  • Method Details

    • acknowledge

      @Nullable Long acknowledge(String group, String... recordIds)
      Acknowledge one or more records as processed.
      Parameters:
      group - name of the consumer group.
      recordIds - record Id's to acknowledge.
      Returns:
      length of acknowledged records. null when used in pipeline / transaction.
      See Also:
    • add

      @Nullable RecordId add(Map<HK,HV> body)
      Append a record to the stream key.
      Parameters:
      body - record body.
      Returns:
      the record Id. null when used in pipeline / transaction.
      See Also:
    • delete

      @Nullable Long delete(String... recordIds)
      Removes the specified entries from the stream. Returns the number of items deleted, that may be different from the number of IDs passed in case certain IDs do not exist.
      Parameters:
      recordIds - stream record Id's.
      Returns:
      number of removed entries. null when used in pipeline / transaction.
      See Also:
    • createGroup

      @Nullable String createGroup(ReadOffset readOffset, String group)
      Create a consumer group.
      Parameters:
      readOffset -
      group - name of the consumer group.
      Returns:
      true if successful. null when used in pipeline / transaction.
    • deleteConsumer

      @Nullable Boolean deleteConsumer(Consumer consumer)
      Delete a consumer from a consumer group.
      Parameters:
      consumer - consumer identified by group name and consumer key.
      Returns:
      true if successful. null when used in pipeline / transaction.
    • destroyGroup

      @Nullable Boolean destroyGroup(String group)
      Destroy a consumer group.
      Parameters:
      group - name of the consumer group.
      Returns:
      true if successful. null when used in pipeline / transaction.
    • size

      @Nullable Long size()
      Get the length of a stream.
      Returns:
      length of the stream. null when used in pipeline / transaction.
      See Also:
    • range

      @Nullable default List<MapRecord<K,HK,HV>> range(Range<String> range)
      Read records from a stream within a specific Range.
      Parameters:
      range - must not be null.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • range

      @Nullable List<MapRecord<K,HK,HV>> range(Range<String> range, Limit limit)
      Read records from a stream within a specific Range applying a Limit.
      Parameters:
      range - must not be null.
      limit - must not be null.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • read

      @Nullable default List<MapRecord<K,HK,HV>> read(ReadOffset readOffset)
      Read records from ReadOffset.
      Parameters:
      readOffset - the offset to read from.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • read

      @Nullable List<MapRecord<K,HK,HV>> read(StreamReadOptions readOptions, ReadOffset readOffset)
      Read records starting from ReadOffset.
      Parameters:
      readOptions - read arguments.
      readOffset - the offset to read from.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • read

      @Nullable default List<MapRecord<K,HK,HV>> read(Consumer consumer, ReadOffset readOffset)
      Read records starting from ReadOffset. using a consumer group.
      Parameters:
      consumer - consumer/group.
      readOffset - the offset to read from.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • read

      @Nullable List<MapRecord<K,HK,HV>> read(Consumer consumer, StreamReadOptions readOptions, ReadOffset readOffset)
      Read records starting from ReadOffset. using a consumer group.
      Parameters:
      consumer - consumer/group.
      readOptions - read arguments.
      readOffset - the offset to read from.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • reverseRange

      @Nullable default List<MapRecord<K,HK,HV>> reverseRange(Range<String> range)
      Read records from a stream within a specific Range in reverse order.
      Parameters:
      range - must not be null.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • reverseRange

      @Nullable List<MapRecord<K,HK,HV>> reverseRange(Range<String> range, Limit limit)
      Read records from a stream within a specific Range applying a Limit in reverse order.
      Parameters:
      range - must not be null.
      limit - must not be null.
      Returns:
      list with members of the resulting stream. null when used in pipeline / transaction.
      See Also:
    • trim

      @Nullable Long trim(long count)
      Trims the stream to count elements.
      Parameters:
      count - length of the stream.
      Returns:
      number of removed entries. null when used in pipeline / transaction.
      See Also:
    • trim

      @Nullable Long trim(long count, boolean approximateTrimming)
      Trims the stream to count elements.
      Parameters:
      count - length of the stream.
      approximateTrimming - the trimming must be performed in a approximated way in order to maximize performances.
      Returns:
      number of removed entries. null when used in pipeline / transaction.
      Since:
      2.4
      See Also: