public interface RedisStreamCommands
Modifier and Type | Interface and Description |
---|---|
static class |
RedisStreamCommands.XAddOptions
Additional options applicable for XADD command.
|
static class |
RedisStreamCommands.XClaimOptions |
static class |
RedisStreamCommands.XPendingOptions
Value Object holding parameters for obtaining pending messages.
|
Modifier and Type | Method and Description |
---|---|
Long |
xAck(byte[] key,
String group,
RecordId... recordIds)
Acknowledge one or more records, identified via their id, as processed.
|
default Long |
xAck(byte[] key,
String group,
String... recordIds)
Acknowledge one or more records, identified via their id, as processed.
|
default RecordId |
xAdd(byte[] key,
Map<byte[],byte[]> content)
Append a new record with the given
field/value pairs as content to the stream stored at key . |
default RecordId |
xAdd(MapRecord<byte[],byte[],byte[]> record)
Append the given
record to the stream stored at Record.getStream() . |
RecordId |
xAdd(MapRecord<byte[],byte[],byte[]> record,
RedisStreamCommands.XAddOptions options)
Append the given
record to the stream stored at Record.getStream() . |
default List<ByteRecord> |
xClaim(byte[] key,
String group,
String newOwner,
Duration minIdleTime,
RecordId... recordIds)
Change the ownership of a pending message to the given new consumer.
|
List<ByteRecord> |
xClaim(byte[] key,
String group,
String newOwner,
RedisStreamCommands.XClaimOptions options)
Change the ownership of a pending message to the given new consumer.
|
List<RecordId> |
xClaimJustId(byte[] key,
String group,
String newOwner,
RedisStreamCommands.XClaimOptions options)
Change the ownership of a pending message to the given new consumer without increasing the delivered
count.
|
Long |
xDel(byte[] key,
RecordId... recordIds)
Removes the records with the given id's from the stream.
|
default Long |
xDel(byte[] key,
String... recordIds)
Removes the records with the given id's from the stream.
|
String |
xGroupCreate(byte[] key,
String groupName,
ReadOffset readOffset)
Create a consumer group.
|
String |
xGroupCreate(byte[] key,
String groupName,
ReadOffset readOffset,
boolean mkStream)
Create a consumer group.
|
Boolean |
xGroupDelConsumer(byte[] key,
Consumer consumer)
Delete a consumer from a consumer group.
|
default Boolean |
xGroupDelConsumer(byte[] key,
String groupName,
String consumerName)
Delete a consumer from a consumer group.
|
Boolean |
xGroupDestroy(byte[] key,
String groupName)
Destroy a consumer group.
|
StreamInfo.XInfoStream |
xInfo(byte[] key)
Obtain general information about the stream stored at the specified key.
|
StreamInfo.XInfoConsumers |
xInfoConsumers(byte[] key,
String groupName)
Obtain information about every consumer in a specific consumer group for the stream stored at the
specified key.
|
StreamInfo.XInfoGroups |
xInfoGroups(byte[] key)
Obtain information about consumer groups associated with the stream stored at the specified
key.
|
Long |
xLen(byte[] key)
Get the length of a stream.
|
default PendingMessages |
xPending(byte[] key,
Consumer consumer)
Obtained detailed information about all pending messages for a given
Consumer . |
default PendingMessages |
xPending(byte[] key,
Consumer consumer,
Range<?> range,
Long count)
|
PendingMessagesSummary |
xPending(byte[] key,
String groupName)
Obtain the
PendingMessagesSummary for a given consumer group. |
default PendingMessages |
xPending(byte[] key,
String groupName,
Range<?> range,
Long count)
|
PendingMessages |
xPending(byte[] key,
String groupName,
RedisStreamCommands.XPendingOptions options)
|
default PendingMessages |
xPending(byte[] key,
String groupName,
String consumerName)
Obtained detailed information about all pending messages for a given consumer.
|
default PendingMessages |
xPending(byte[] key,
String groupName,
String consumerName,
Range<?> range,
Long count)
|
default List<ByteRecord> |
xRange(byte[] key,
Range<String> range)
|
List<ByteRecord> |
xRange(byte[] key,
Range<String> range,
RedisZSetCommands.Limit limit)
|
default List<ByteRecord> |
xRead(StreamOffset<byte[]>... streams)
Read records from one or more
StreamOffset s. |
List<ByteRecord> |
xRead(StreamReadOptions readOptions,
StreamOffset<byte[]>... streams)
Read records from one or more
StreamOffset s. |
default List<ByteRecord> |
xReadGroup(Consumer consumer,
StreamOffset<byte[]>... streams)
Read records from one or more
StreamOffset s using a consumer group. |
List<ByteRecord> |
xReadGroup(Consumer consumer,
StreamReadOptions readOptions,
StreamOffset<byte[]>... streams)
Read records from one or more
StreamOffset s using a consumer group. |
default List<ByteRecord> |
xRevRange(byte[] key,
Range<String> range)
Read records from a stream within a specific
Range in reverse order. |
List<ByteRecord> |
xRevRange(byte[] key,
Range<String> range,
RedisZSetCommands.Limit limit)
Read records from a stream within a specific
Range applying a RedisZSetCommands.Limit in reverse order. |
Long |
xTrim(byte[] key,
long count)
Trims the stream to
count elements. |
Long |
xTrim(byte[] key,
long count,
boolean approximateTrimming)
Trims the stream to
count elements. |
@Nullable default Long xAck(byte[] key, String group, String... recordIds)
key
- the key the stream is stored at.group
- name of the consumer group.recordIds
- the String representation of the id's of the records to acknowledge.@Nullable Long xAck(byte[] key, String group, RecordId... recordIds)
key
- the key the stream is stored at.group
- name of the consumer group.recordIds
- the id's of the records to acknowledge.@Nullable default RecordId xAdd(byte[] key, Map<byte[],byte[]> content)
field/value pairs
as content to the stream stored at key
.key
- the key the stream is stored at.content
- the records content modeled as field/value pairs
.id
. null when used in pipeline / transaction.@Nullable default RecordId xAdd(MapRecord<byte[],byte[],byte[]> record)
record
to the stream stored at Record.getStream()
. Record.withId(RecordId)
.@Nullable RecordId xAdd(MapRecord<byte[],byte[],byte[]> record, RedisStreamCommands.XAddOptions options)
record
to the stream stored at Record.getStream()
. Record.withId(RecordId)
.record
- the record
to append.options
- additional options (eg. MAXLEN). Must not be null, use
RedisStreamCommands.XAddOptions.none()
instead.id
after save. null when used in pipeline / transaction.@Nullable List<RecordId> xClaimJustId(byte[] key, String group, String newOwner, RedisStreamCommands.XClaimOptions options)
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.options
- must not be null.ids
that changed user.@Nullable default List<ByteRecord> xClaim(byte[] key, String group, String newOwner, Duration minIdleTime, RecordId... recordIds)
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.minIdleTime
- must not be null.recordIds
- must not be null.ByteRecord
that changed user.@Nullable List<ByteRecord> xClaim(byte[] key, String group, String newOwner, RedisStreamCommands.XClaimOptions options)
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.options
- must not be null.ByteRecord
that changed user.@Nullable default Long xDel(byte[] key, String... recordIds)
key
- the key the stream is stored at.recordIds
- the id's of the records to remove.@Nullable Long xDel(byte[] key, RecordId... recordIds)
key
- the key the stream is stored at.recordIds
- the id's of the records to remove.@Nullable String xGroupCreate(byte[] key, String groupName, ReadOffset readOffset)
key
- the key the stream is stored at.groupName
- name of the consumer group to create.readOffset
- the offset to start at.@Nullable String xGroupCreate(byte[] key, String groupName, ReadOffset readOffset, boolean mkStream)
key
- the key the stream is stored at.groupName
- name of the consumer group to create.readOffset
- the offset to start at.mkStream
- if true the group will create the stream if not already present (MKSTREAM)@Nullable default Boolean xGroupDelConsumer(byte[] key, String groupName, String consumerName)
key
- the key the stream is stored at.groupName
- the name of the group to remove the consumer from.consumerName
- the name of the consumer to remove from the group.@Nullable Boolean xGroupDelConsumer(byte[] key, Consumer consumer)
key
- the key the stream is stored at.consumer
- consumer identified by group name and consumer name.@Nullable Boolean xGroupDestroy(byte[] key, String groupName)
key
- the key the stream is stored at.groupName
- name of the consumer group.@Nullable StreamInfo.XInfoStream xInfo(byte[] key)
key
- the key the stream is stored at.@Nullable StreamInfo.XInfoGroups xInfoGroups(byte[] key)
key
- the key the stream is stored at.@Nullable StreamInfo.XInfoConsumers xInfoConsumers(byte[] key, String groupName)
key
- the key the stream is stored at.groupName
- name of the consumer group.@Nullable Long xLen(byte[] key)
key
- the key the stream is stored at.@Nullable PendingMessagesSummary xPending(byte[] key, String groupName)
PendingMessagesSummary
for a given consumer group.key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.@Nullable default PendingMessages xPending(byte[] key, Consumer consumer)
Consumer
.key
- the key the stream is stored at. Must not be null.consumer
- the consumer to fetch PendingMessages
for. Must not be null.Consumer
or null when used in pipeline / transaction.@Nullable default PendingMessages xPending(byte[] key, String groupName, String consumerName)
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.consumerName
- the consumer to fetch PendingMessages
for. Must not be null.Consumer
or null when used in pipeline / transaction.@Nullable default PendingMessages xPending(byte[] key, String groupName, Range<?> range, Long count)
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.range
- the range of messages ids to search within. Must not be null.count
- limit the number of results. Must not be null.@Nullable default PendingMessages xPending(byte[] key, Consumer consumer, Range<?> range, Long count)
messages
for a given Range
and
Consumer
within a consumer group.key
- the key the stream is stored at. Must not be null.consumer
- the name of the Consumer
. Must not be null.range
- the range of messages ids to search within. Must not be null.count
- limit the number of results. Must not be null.Consumer
or null when used in pipeline / transaction.@Nullable default PendingMessages xPending(byte[] key, String groupName, String consumerName, Range<?> range, Long count)
messages
for a given Range
and
consumer within a consumer group.key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.consumerName
- the name of the consumer. Must not be null.range
- the range of messages ids to search within. Must not be null.count
- limit the number of results. Must not be null.@Nullable PendingMessages xPending(byte[] key, String groupName, RedisStreamCommands.XPendingOptions options)
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.options
- the options containing range, consumer and count. Must not be
null.@Nullable default List<ByteRecord> xRange(byte[] key, Range<String> range)
records
within a specific Range
from the stream stored at key.
Range.unbounded()
to read from the minimum and the maximum ID possible.key
- the key the stream is stored at.range
- must not be null.@Nullable List<ByteRecord> xRange(byte[] key, Range<String> range, RedisZSetCommands.Limit limit)
limited number
of records
within a specific Range
from the
stream stored at key. Range.unbounded()
to read from the minimum and the maximum ID possible. RedisZSetCommands.Limit.unlimited()
to read all records.key
- the key the stream is stored at.range
- must not be null.limit
- must not be null.@Nullable default List<ByteRecord> xRead(StreamOffset<byte[]>... streams)
StreamOffset
s.streams
- the streams to read from.@Nullable List<ByteRecord> xRead(StreamReadOptions readOptions, StreamOffset<byte[]>... streams)
StreamOffset
s.readOptions
- read arguments.streams
- the streams to read from.@Nullable default List<ByteRecord> xReadGroup(Consumer consumer, StreamOffset<byte[]>... streams)
StreamOffset
s using a consumer group.consumer
- consumer/group.streams
- the streams to read from.@Nullable List<ByteRecord> xReadGroup(Consumer consumer, StreamReadOptions readOptions, StreamOffset<byte[]>... streams)
StreamOffset
s using a consumer group.consumer
- consumer/group.readOptions
- read arguments.streams
- the streams to read from.@Nullable default List<ByteRecord> xRevRange(byte[] key, Range<String> range)
Range
in reverse order.key
- the stream key.range
- must not be null.@Nullable List<ByteRecord> xRevRange(byte[] key, Range<String> range, RedisZSetCommands.Limit limit)
Range
applying a RedisZSetCommands.Limit
in reverse order.key
- the stream key.range
- must not be null.limit
- must not be null.@Nullable Long xTrim(byte[] key, long count)
count
elements.key
- the stream key.count
- length of the stream.@Nullable Long xTrim(byte[] key, long count, boolean approximateTrimming)
count
elements.key
- the stream key.count
- length of the stream.approximateTrimming
- the trimming must be performed in a approximated way in order to maximize performances.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.