Interface BoundStreamOperations<K,HK,HV>


@NullUnmarked 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

      Long acknowledge(@NonNull String group, @NonNull String @NonNull ... 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

      RecordId add(@NonNull Map<@NonNull 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:
    • add

      RecordId add(@NonNull Map<@NonNull HK, HV> content, @NonNull RedisStreamCommands.XAddOptions xAddOptions)
      Append a record to the stream key with the specified options.
      Parameters:
      content - record content as Map.
      xAddOptions - additional parameters for the XADD call.
      Returns:
      the record Id. null when used in pipeline / transaction.
      Since:
      3.4
      See Also:
    • delete

      Long delete(@NonNull String @NonNull ... 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

      String createGroup(@NonNull ReadOffset readOffset, @NonNull 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

      Boolean deleteConsumer(@NonNull 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

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

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

      default List<@NonNull MapRecord<K,HK,HV>> range(@NonNull 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

      List<@NonNull MapRecord<K,HK,HV>> range(@NonNull Range<String> range, @NonNull 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

      default List<@NonNull MapRecord<K,HK,HV>> read(@NonNull 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

      List<@NonNull MapRecord<K,HK,HV>> read(@NonNull StreamReadOptions readOptions, @NonNull 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

      default List<@NonNull MapRecord<K,HK,HV>> read(@NonNull Consumer consumer, @NonNull 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

      List<@NonNull MapRecord<K,HK,HV>> read(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull 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

      default List<@NonNull MapRecord<K,HK,HV>> reverseRange(@NonNull 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

      List<@NonNull MapRecord<K,HK,HV>> reverseRange(@NonNull Range<String> range, @NonNull 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

      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

      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: