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, Viktoriya Kutsarova
-
Method Summary
Modifier and TypeMethodDescriptionacknowledge(@NonNull String group, @NonNull String @NonNull ... recordIds) Acknowledge one or more records as processed.acknowledgeAndDelete(@NonNull String group, @NonNull RedisStreamCommands.XDelOptions options, @NonNull String @NonNull ... recordIds) Acknowledges and conditionally deletes one or multiple entries for a stream consumer group at the specified key.acknowledgeAndDelete(@NonNull String group, @NonNull RedisStreamCommands.XDelOptions options, @NonNull RecordId @NonNull ... recordIds) Acknowledges and conditionally deletes one or multiple entries for a stream consumer group at the specified key.Append a record to the streamkey.add(@NonNull Map<@NonNull HK, HV> content, @NonNull RedisStreamCommands.XAddOptions xAddOptions) Append a record to the streamkeywith the specified options.createGroup(@NonNull ReadOffset readOffset, @NonNull String group) Create a consumer group.Removes the specified entries from the stream.deleteConsumer(@NonNull Consumer consumer) Delete a consumer from a consumer group.deleteWithOptions(@NonNull RedisStreamCommands.XDelOptions options, @NonNull String @NonNull ... recordIds) Deletes one or multiple entries from the stream at the specified key with extended options.deleteWithOptions(@NonNull RedisStreamCommands.XDelOptions options, @NonNull RecordId @NonNull ... recordIds) Deletes one or multiple entries from the stream at the specified key with extended options.destroyGroup(@NonNull String group) Destroy a consumer group.Read records from a stream within a specificRange.read(@NonNull Consumer consumer, @NonNull ReadOffset readOffset) Read records starting fromReadOffset. using a consumer group.read(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull ReadOffset readOffset) Read records starting fromReadOffset. using a consumer group.read(@NonNull ReadOffset readOffset) Read records fromReadOffset.read(@NonNull StreamReadOptions readOptions, @NonNull ReadOffset readOffset) Read records starting fromReadOffset.reverseRange(@NonNull Range<String> range) Read records from a stream within a specificRangein reverse order.reverseRange(@NonNull Range<String> range, @NonNull Limit limit) size()Get the length of a stream.trim(long count) Trims the stream tocountelements.trim(long count, boolean approximateTrimming) Trims the stream tocountelements.trim(@NonNull RedisStreamCommands.XTrimOptions options) Trims the stream according to the specifiedRedisStreamCommands.XTrimOptions.
-
Method Details
-
acknowledge
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
-
add
RecordId add(@NonNull Map<@NonNull HK, HV> content, @NonNull RedisStreamCommands.XAddOptions xAddOptions) Append a record to the streamkeywith 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
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:
-
deleteWithOptions
List<RedisStreamCommands.StreamEntryDeletionResult> deleteWithOptions(@NonNull RedisStreamCommands.XDelOptions options, @NonNull String @NonNull ... recordIds) Deletes one or multiple entries from the stream at the specified key with extended options.- Parameters:
options- theRedisStreamCommands.XDelOptionsspecifying deletion policy.recordIds- stream record Id's as strings.- Returns:
- list of
RedisStreamCommands.StreamEntryDeletionResultfor each ID. - Since:
- 4.1
- See Also:
-
deleteWithOptions
List<RedisStreamCommands.StreamEntryDeletionResult> deleteWithOptions(@NonNull RedisStreamCommands.XDelOptions options, @NonNull RecordId @NonNull ... recordIds) Deletes one or multiple entries from the stream at the specified key with extended options.- Parameters:
options- theRedisStreamCommands.XDelOptionsspecifying deletion policy.recordIds- stream record Id's.- Returns:
- list of
RedisStreamCommands.StreamEntryDeletionResultfor each ID. - Since:
- 4.1
- See Also:
-
acknowledgeAndDelete
List<RedisStreamCommands.StreamEntryDeletionResult> acknowledgeAndDelete(@NonNull String group, @NonNull RedisStreamCommands.XDelOptions options, @NonNull String @NonNull ... recordIds) Acknowledges and conditionally deletes one or multiple entries for a stream consumer group at the specified key.- Parameters:
group- name of the consumer group.options- theRedisStreamCommands.XDelOptionsspecifying deletion policy.recordIds- stream record Id's as strings.- Returns:
- list of
RedisStreamCommands.StreamEntryDeletionResultfor each ID. - Since:
- 4.1
- See Also:
-
acknowledgeAndDelete
List<RedisStreamCommands.StreamEntryDeletionResult> acknowledgeAndDelete(@NonNull String group, @NonNull RedisStreamCommands.XDelOptions options, @NonNull RecordId @NonNull ... recordIds) Acknowledges and conditionally deletes one or multiple entries for a stream consumer group at the specified key.- Parameters:
group- name of the consumer group.options- theRedisStreamCommands.XDelOptionsspecifying deletion policy.recordIds- stream record Id's.- Returns:
- list of
RedisStreamCommands.StreamEntryDeletionResultfor each ID. - Since:
- 4.1
- See Also:
-
createGroup
Create a consumer group.- Parameters:
readOffset-group- name of the consumer group.- Returns:
- true if successful. null when used in pipeline / transaction.
-
deleteConsumer
-
destroyGroup
-
size
Long size()Get the length of a stream.- Returns:
- length of the stream. null when used in pipeline / transaction.
- See Also:
-
range
-
range
- 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
Read records fromReadOffset.- 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, readHV>> (@NonNull StreamReadOptions readOptions, @NonNull ReadOffset readOffset) Read records starting fromReadOffset.- 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, readHV>> (@NonNull Consumer consumer, @NonNull ReadOffset readOffset) Read records starting fromReadOffset. 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, readHV>> (@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull ReadOffset readOffset) Read records starting fromReadOffset. 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
-
reverseRange
- 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
Trims the stream tocountelements.- Parameters:
count- length of the stream.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- See Also:
-
trim
Trims the stream tocountelements.- 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:
-
trim
Trims the stream according to the specifiedRedisStreamCommands.XTrimOptions.Supports various trimming strategies including MAXLEN (limit by count) and MINID (evict entries older than a specific ID), with options for approximate or exact trimming.
- Parameters:
options- the trimming options specifying the strategy and parameters. Must not be null.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- Since:
- 2.7.4
- See Also:
-