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 Summary
Modifier and TypeMethodDescriptionacknowledge
(String group, String... recordIds) Acknowledge one or more records as processed.Append a record to the streamkey
.add
(Map<HK, HV> content, RedisStreamCommands.XAddOptions xAddOptions) Append a record to the streamkey
with the specified options.createGroup
(ReadOffset readOffset, String group) Create a consumer group.Removes the specified entries from the stream.deleteConsumer
(Consumer consumer) Delete a consumer from a consumer group.destroyGroup
(String group) Destroy a consumer group.Read records from a stream within a specificRange
.read
(Consumer consumer, ReadOffset readOffset) Read records starting fromReadOffset
. using a consumer group.read
(Consumer consumer, StreamReadOptions readOptions, ReadOffset readOffset) Read records starting fromReadOffset
. using a consumer group.read
(ReadOffset readOffset) Read records fromReadOffset
.read
(StreamReadOptions readOptions, ReadOffset readOffset) Read records starting fromReadOffset
.reverseRange
(Range<String> range) Read records from a stream within a specificRange
in reverse order.reverseRange
(Range<String> range, Limit limit) size()
Get the length of a stream.trim
(long count) Trims the stream tocount
elements.trim
(long count, boolean approximateTrimming) Trims the stream tocount
elements.
-
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
Append a record to the streamkey
.- Parameters:
body
- record body.- Returns:
- the record Id. null when used in pipeline / transaction.
- See Also:
-
add
Append a record to the streamkey
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
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
Create a consumer group.- Parameters:
readOffset
-group
- name of the consumer group.- Returns:
- true if successful. null when used in pipeline / transaction.
-
deleteConsumer
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
Destroy a consumer group.- Parameters:
group
- name of the consumer group.- Returns:
- true if successful. null when used in pipeline / transaction.
-
size
Get the length of a stream.- Returns:
- length of the stream. null when used in pipeline / transaction.
- See Also:
-
range
Read records from a stream within a specificRange
.- Parameters:
range
- must not be null.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- See Also:
-
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
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
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
@Nullable List<MapRecord<K,HK, readHV>> (Consumer consumer, StreamReadOptions readOptions, 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
Read records from a stream within a specificRange
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
- 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 tocount
elements.- Parameters:
count
- length of the stream.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- See Also:
-
trim
Trims the stream tocount
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:
-