Package glide.api.commands
Interface StreamBaseCommands
-
- All Known Implementing Classes:
BaseClient,GlideClient,GlideClusterClient
public interface StreamBaseCommandsSupports commands for the "Stream Commands" group for standalone and cluster clients.- See Also:
- Stream Commands
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>xack(GlideString key, GlideString group, GlideString[] ids)Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.java.util.concurrent.CompletableFuture<java.lang.Long>xack(java.lang.String key, java.lang.String group, java.lang.String[] ids)Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.java.util.concurrent.CompletableFuture<GlideString>xadd(GlideString key, GlideString[][] values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<GlideString>xadd(GlideString key, GlideString[][] values, StreamAddOptionsBinary options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<GlideString>xadd(GlideString key, java.util.Map<GlideString,GlideString> values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<GlideString>xadd(GlideString key, java.util.Map<GlideString,GlideString> values, StreamAddOptionsBinary options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<java.lang.String>xadd(java.lang.String key, java.lang.String[][] values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<java.lang.String>xadd(java.lang.String key, java.lang.String[][] values, StreamAddOptions options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<java.lang.String>xadd(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<java.lang.String>xadd(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values, StreamAddOptions options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start, long count)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start, long count)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start, long count)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.lang.Object[]>xautoclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start, long count)Transfers ownership of pending stream entries that match the specified criteria.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids, StreamClaimOptions options)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids, StreamClaimOptions options)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<GlideString[]>xclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<GlideString[]>xclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids, StreamClaimOptions options)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.lang.String[]>xclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.lang.String[]>xclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids, StreamClaimOptions options)Changes the ownership of a pending message.java.util.concurrent.CompletableFuture<java.lang.Long>xdel(GlideString key, GlideString[] ids)Removes the specified entries by id from a stream, and returns the number of entries deleted.java.util.concurrent.CompletableFuture<java.lang.Long>xdel(java.lang.String key, java.lang.String[] ids)Removes the specified entries by id from a stream, and returns the number of entries deleted.java.util.concurrent.CompletableFuture<java.lang.String>xgroupCreate(GlideString key, GlideString groupname, GlideString id)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.String>xgroupCreate(GlideString key, GlideString groupName, GlideString id, StreamGroupOptions options)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.String>xgroupCreate(java.lang.String key, java.lang.String groupname, java.lang.String id)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.String>xgroupCreate(java.lang.String key, java.lang.String groupName, java.lang.String id, StreamGroupOptions options)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Boolean>xgroupCreateConsumer(GlideString key, GlideString group, GlideString consumer)Creates a consumer namedconsumerin the consumer groupgroupfor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Boolean>xgroupCreateConsumer(java.lang.String key, java.lang.String group, java.lang.String consumer)Creates a consumer namedconsumerin the consumer groupgroupfor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Long>xgroupDelConsumer(GlideString key, GlideString group, GlideString consumer)Deletes a consumer namedconsumerin the consumer groupgroup.java.util.concurrent.CompletableFuture<java.lang.Long>xgroupDelConsumer(java.lang.String key, java.lang.String group, java.lang.String consumer)Deletes a consumer namedconsumerin the consumer groupgroup.java.util.concurrent.CompletableFuture<java.lang.Boolean>xgroupDestroy(GlideString key, GlideString groupname)Destroys the consumer groupgroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Boolean>xgroupDestroy(java.lang.String key, java.lang.String groupname)Destroys the consumer groupgroupnamefor the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.String>xgroupSetId(GlideString key, GlideString groupName, GlideString id)Sets the last delivered ID for a consumer group.java.util.concurrent.CompletableFuture<java.lang.String>xgroupSetId(GlideString key, GlideString groupName, GlideString id, long entriesRead)Sets the last delivered ID for a consumer group.java.util.concurrent.CompletableFuture<java.lang.String>xgroupSetId(java.lang.String key, java.lang.String groupName, java.lang.String id)Sets the last delivered ID for a consumer group.java.util.concurrent.CompletableFuture<java.lang.String>xgroupSetId(java.lang.String key, java.lang.String groupName, java.lang.String id, long entriesRead)Sets the last delivered ID for a consumer group.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>[]>xinfoConsumers(GlideString key, GlideString groupName)Returns the list of all consumers and their attributes for the given consumer group of the stream stored atkey.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>[]>xinfoConsumers(java.lang.String key, java.lang.String groupName)Returns the list of all consumers and their attributes for the given consumer group of the stream stored atkey.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>[]>xinfoGroups(GlideString key)Returns the list of all consumer groups and their attributes for the stream stored atkey.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>[]>xinfoGroups(java.lang.String key)Returns the list of all consumer groups and their attributes for the stream stored atkey.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>>xinfoStream(GlideString key)Returns information about the stream stored at keykey.
To get more detailed information usexinfoStreamFull(GlideString)orxinfoStreamFull(GlideString, int).java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>xinfoStream(java.lang.String key)Returns information about the stream stored at keykey.
To get more detailed information usexinfoStreamFull(String)orxinfoStreamFull(String, int).java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>>xinfoStreamFull(GlideString key)Returns verbose information about the stream stored at keykey.
The output is limited by first10PEL entries.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>>xinfoStreamFull(GlideString key, int count)Returns verbose information about the stream stored at keykey.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>xinfoStreamFull(java.lang.String key)Returns verbose information about the stream stored at keykey.
The output is limited by first10PEL entries.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>xinfoStreamFull(java.lang.String key, int count)Returns verbose information about the stream stored at keykey.java.util.concurrent.CompletableFuture<java.lang.Long>xlen(GlideString key)Returns the number of entries in the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Long>xlen(java.lang.String key)Returns the number of entries in the stream stored atkey.java.util.concurrent.CompletableFuture<java.lang.Object[]>xpending(GlideString key, GlideString group)Returns stream message summary information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.lang.Object[][]>xpending(GlideString key, GlideString group, StreamRange start, StreamRange end, long count)Returns an extended form of stream message information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.lang.Object[][]>xpending(GlideString key, GlideString group, StreamRange start, StreamRange end, long count, StreamPendingOptionsBinary options)Returns an extended form of stream message information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.lang.Object[]>xpending(java.lang.String key, java.lang.String group)Returns stream message summary information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.lang.Object[][]>xpending(java.lang.String key, java.lang.String group, StreamRange start, StreamRange end, long count)Returns an extended form of stream message information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.lang.Object[][]>xpending(java.lang.String key, java.lang.String group, StreamRange start, StreamRange end, long count, StreamPendingOptions options)Returns an extended form of stream message information for pending messages matching a given range of IDs.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xrange(GlideString key, StreamRange start, StreamRange end)Returns stream entries matching a given range of IDs.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xrange(GlideString key, StreamRange start, StreamRange end, long count)Returns stream entries matching a given range of IDs.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xrange(java.lang.String key, StreamRange start, StreamRange end)Returns stream entries matching a given range of IDs.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xrange(java.lang.String key, StreamRange start, StreamRange end, long count)Returns stream entries matching a given range of IDs.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>>xread(java.util.Map<java.lang.String,java.lang.String> keysAndIds)Reads entries from the given streams.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>>xread(java.util.Map<java.lang.String,java.lang.String> keysAndIds, StreamReadOptions options)Reads entries from the given streams.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>>xreadBinary(java.util.Map<GlideString,GlideString> keysAndIds)Reads entries from the given streams.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>>xreadBinary(java.util.Map<GlideString,GlideString> keysAndIds, StreamReadOptions options)Reads entries from the given streams.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>>xreadgroup(java.util.Map<GlideString,GlideString> keysAndIds, GlideString group, GlideString consumer)Reads entries from the given streams owned by a consumer group.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>>xreadgroup(java.util.Map<GlideString,GlideString> keysAndIds, GlideString group, GlideString consumer, StreamReadGroupOptions options)Reads entries from the given streams owned by a consumer group.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>>xreadgroup(java.util.Map<java.lang.String,java.lang.String> keysAndIds, java.lang.String group, java.lang.String consumer)Reads entries from the given streams owned by a consumer group.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>>xreadgroup(java.util.Map<java.lang.String,java.lang.String> keysAndIds, java.lang.String group, java.lang.String consumer, StreamReadGroupOptions options)Reads entries from the given streams owned by a consumer group.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xrevrange(GlideString key, StreamRange end, StreamRange start)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(GlideString, StreamRange, StreamRange)but returns the entries in reverse order.java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>>xrevrange(GlideString key, StreamRange end, StreamRange start, long count)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(GlideString, StreamRange, StreamRange, long)but returns the entries in reverse order.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xrevrange(java.lang.String key, StreamRange end, StreamRange start)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(String, StreamRange, StreamRange)but returns the entries in reverse order.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>>xrevrange(java.lang.String key, StreamRange end, StreamRange start, long count)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(String, StreamRange, StreamRange, long)but returns the entries in reverse order.java.util.concurrent.CompletableFuture<java.lang.Long>xtrim(GlideString key, StreamTrimOptions options)Trims the stream by evicting older entries.java.util.concurrent.CompletableFuture<java.lang.Long>xtrim(java.lang.String key, StreamTrimOptions options)Trims the stream by evicting older entries.
-
-
-
Method Detail
-
xadd
java.util.concurrent.CompletableFuture<java.lang.String> xadd(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. To add entries with duplicate keys, usexadd(String, String[][]).- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.- Returns:
- The id of the added entry.
- See Also:
- valkey.io for details.
- Example:
String streamId = client.xadd("key", Map.of("name", "Sara", "surname", "OConnor").get(); System.out.println("Stream: " + streamId);
-
xadd
java.util.concurrent.CompletableFuture<java.lang.String> xadd(java.lang.String key, java.lang.String[][] values)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. This method overload allows entries with duplicate keys to be added.- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.- Returns:
- The id of the added entry.
- See Also:
- valkey.io for details.
- Example:
String streamId = client.xadd("key", new String[][] {{"name", "Sara"}, {"surname", "OConnor"}}).get(); System.out.println("Stream: " + streamId);
-
xadd
java.util.concurrent.CompletableFuture<GlideString> xadd(GlideString key, java.util.Map<GlideString,GlideString> values)
Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. To add entries with duplicate keys, usexadd(GlideString, GlideString[][]).- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.- Returns:
- The id of the added entry.
- See Also:
- valkey.io for details.
- Example:
String streamId = client.xadd(gs("key"), Map.of(gs("name"), gs("Sara"), gs("surname"), gs("OConnor")).get(); System.out.println("Stream: " + streamId);
-
xadd
java.util.concurrent.CompletableFuture<GlideString> xadd(GlideString key, GlideString[][] values)
Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. This method overload allows entries with duplicate keys to be added.- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.- Returns:
- The id of the added entry.
- See Also:
- valkey.io for details.
- Example:
String streamId = client.xadd(gs("key"), new String[][] {{gs("name"), gs("Sara")}, {gs("surname"), gs("OConnor")}}).get(); System.out.println("Stream: " + streamId);
-
xadd
java.util.concurrent.CompletableFuture<java.lang.String> xadd(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values, StreamAddOptions options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. To add entries with duplicate keys, usexadd(String, String[][], StreamAddOptions).- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.options- Stream add optionsStreamAddOptions.- Returns:
- The id of the added entry, or
nullifStreamAddOptions.StreamAddOptionsBuilder.makeStream(Boolean)is set tofalseand no stream with the matchingkeyexists. - See Also:
- valkey.io for details.
- Example:
// Option to use the existing stream, or return null if the stream doesn't already exist at "key" StreamAddOptions options = StreamAddOptions.builder().id("1-0").makeStream(Boolean.FALSE).build(); String streamId = client.xadd("key", Map.of("name", "Sara", "surname", "OConnor"), options).get(); if (streamId != null) { assert streamId.equals("1-0"); }
-
xadd
java.util.concurrent.CompletableFuture<java.lang.String> xadd(java.lang.String key, java.lang.String[][] values, StreamAddOptions options)Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. This method overload allows entries with duplicate keys to be added.- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.options- Stream add optionsStreamAddOptions.- Returns:
- The id of the added entry, or
nullifStreamAddOptions.StreamAddOptionsBuilder.makeStream(Boolean)is set tofalseand no stream with the matchingkeyexists. - See Also:
- valkey.io for details.
- Example:
// Option to use the existing stream, or return null if the stream doesn't already exist at "key" StreamAddOptions options = StreamAddOptions.builder().id("1-0").makeStream(Boolean.FALSE).build(); String streamId = client.xadd("key", new String[][] {{"name", "Sara"}, {"surname", "OConnor"}}, options).get(); if (streamId != null) { assert streamId.equals("1-0"); }
-
xadd
java.util.concurrent.CompletableFuture<GlideString> xadd(GlideString key, java.util.Map<GlideString,GlideString> values, StreamAddOptionsBinary options)
Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. To add entries with duplicate keys, usexadd(GlideString, GlideString[][], StreamAddOptionsBinary).- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.options- Stream add optionsStreamAddOptions.- Returns:
- The id of the added entry, or
nullifStreamAddOptionsBinary.StreamAddOptionsBinaryBuilder.makeStream(Boolean)is set tofalseand no stream with the matchingkeyexists. - See Also:
- valkey.io for details.
- Example:
// Option to use the existing stream, or return null if the stream doesn't already exist at "key" StreamAddOptionsBinary options = StreamAddOptions.builder().id(gs("1-0")).makeStream(Boolean.FALSE).build(); String streamId = client.xadd(gs("key"), Map.of(gs("name"), gs("Sara"), gs("surname"), gs("OConnor")), options).get(); if (streamId != null) { assert streamId.equals("1-0"); }
-
xadd
java.util.concurrent.CompletableFuture<GlideString> xadd(GlideString key, GlideString[][] values, StreamAddOptionsBinary options)
Adds an entry to the specified stream stored atkey.
If thekeydoesn't exist, the stream is created. This method overload allows entries with duplicate keys to be added.- Parameters:
key- The key of the stream.values- Field-value pairs to be added to the entry.options- Stream add optionsStreamAddOptions.- Returns:
- The id of the added entry, or
nullifStreamAddOptionsBinary.StreamAddOptionsBinaryBuilder.makeStream(Boolean)is set tofalseand no stream with the matchingkeyexists. - See Also:
- valkey.io for details.
- Example:
// Option to use the existing stream, or return null if the stream doesn't already exist at "key" StreamAddOptionsBinary options = StreamAddOptions.builder().id(gs("1-0")).makeStream(Boolean.FALSE).build(); String streamId = client.xadd(gs("key"), new GlideString[][] {{gs("name"), gs("Sara")}, {gs("surname"), gs("OConnor")}}, options).get(); if (streamId != null) { assert streamId.equals("1-0"); }
-
xread
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>> xread(java.util.Map<java.lang.String,java.lang.String> keysAndIds)
Reads entries from the given streams.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.- Returns:
- A
Map<String, Map<String, String[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
Map<String, String> xreadKeys = Map.of("streamKey", "0-0"); Map<String, Map<String, String[][]>> streamReadResponse = client.xread(xreadKeys).get(); for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xreadBinary
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>> xreadBinary(java.util.Map<GlideString,GlideString> keysAndIds)
Reads entries from the given streams.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.- Returns:
- A
Map<String, Map<String, String[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
Map<GlideString, GlideString> xreadKeys = Map.of(gs("streamKey"), gs("0-0")); Map<GlideString, Map<GlideString, GlideString[][]>> streamReadResponse = client.xread(xreadKeys).get(); for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xread
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>> xread(java.util.Map<java.lang.String,java.lang.String> keysAndIds, StreamReadOptions options)Reads entries from the given streams.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.options- Options detailing how to read the streamStreamReadOptions.- Returns:
- A
Map<String, Map<String, String[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. Returnsnullif all key-ID pairs inkeys_and_idshave either a non-existing key or a non-existing ID, or there are no entries after the given ID, or a timeout is hit in the block option. - See Also:
- valkey.io for details.
- Example:
// retrieve streamKey entries and block for 1 second if is no stream data Map<String, String> xreadKeys = Map.of("streamKey", "0-0"); StreamReadOptions options = StreamReadOptions.builder().block(1L).build(); Map<String, Map<String, String[][]>> streamReadResponse = client.xread(xreadKeys, options).get(); for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xreadBinary
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>> xreadBinary(java.util.Map<GlideString,GlideString> keysAndIds, StreamReadOptions options)
Reads entries from the given streams.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.options- Options detailing how to read the streamStreamReadOptions.- Returns:
- A
Map<GlideString, Map<GlideString, GlideString[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
// retrieve streamKey entries and block for 1 second if is no stream data Map<String, String> xreadKeys = Map.of(gs("streamKey"), gs("0-0")); StreamReadOptions options = StreamReadOptions.builder().block(1L).build(); Map<GlideString, Map<GlideString, GlideString[][]>> streamReadResponse = client.xread(xreadKeys, options).get(); for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xtrim
java.util.concurrent.CompletableFuture<java.lang.Long> xtrim(java.lang.String key, StreamTrimOptions options)Trims the stream by evicting older entries.- Parameters:
key- The key of the stream.options- Stream trim optionsStreamTrimOptions.- Returns:
- The number of entries deleted from the stream.
- See Also:
- valkey.io for details.
- Example:
// A nearly exact trimming of the stream to at least a length of 10 Long trimmed = client.xtrim("key", new MaxLen(false, 10L)).get(); System.out.println("Number of trimmed entries from stream: " + trimmed); // An exact trimming of the stream by minimum id of "0-3", limit of 10 entries Long trimmed = client.xtrim("key", new MinId(true, "0-3", 10L)).get(); System.out.println("Number of trimmed entries from stream: " + trimmed);
-
xtrim
java.util.concurrent.CompletableFuture<java.lang.Long> xtrim(GlideString key, StreamTrimOptions options)
Trims the stream by evicting older entries.- Parameters:
key- The key of the stream.options- Stream trim optionsStreamTrimOptions.- Returns:
- The number of entries deleted from the stream.
- See Also:
- valkey.io for details.
- Example:
// A nearly exact trimming of the stream to at least a length of 10 Long trimmed = client.xtrim(gs("key"), new MaxLen(false, 10L)).get(); System.out.println("Number of trimmed entries from stream: " + trimmed); // An exact trimming of the stream by minimum id of "0-3", limit of 10 entries Long trimmed = client.xtrim(gs("key"), new MinId(true, "0-3", 10L)).get(); System.out.println("Number of trimmed entries from stream: " + trimmed);
-
xlen
java.util.concurrent.CompletableFuture<java.lang.Long> xlen(java.lang.String key)
Returns the number of entries in the stream stored atkey.- Parameters:
key- The key of the stream.- Returns:
- The number of entries in the stream. If
keydoes not exist, return0. - See Also:
- valkey.io for details.
- Example:
Long num = client.xlen("key").get(); assert num == 2L; // Stream has 2 entries
-
xlen
java.util.concurrent.CompletableFuture<java.lang.Long> xlen(GlideString key)
Returns the number of entries in the stream stored atkey.- Parameters:
key- The key of the stream.- Returns:
- The number of entries in the stream. If
keydoes not exist, return0. - See Also:
- valkey.io for details.
- Example:
Long num = client.xlen(gs("key")).get(); assert num == 2L; // Stream has 2 entries
-
xdel
java.util.concurrent.CompletableFuture<java.lang.Long> xdel(java.lang.String key, java.lang.String[] ids)Removes the specified entries by id from a stream, and returns the number of entries deleted.- Parameters:
key- The key of the stream.ids- An array of entry ids.- Returns:
- The number of entries removed from the stream. This number may be less than the number
of entries in
ids, if the specifiedidsdon't exist in the stream. - See Also:
- valkey.io for details.
- Example:
Long num = client.xdel("key", new String[] {"1538561698944-0", "1538561698944-1"}).get(); assert num == 2L; // Stream marked 2 entries as deleted
-
xdel
java.util.concurrent.CompletableFuture<java.lang.Long> xdel(GlideString key, GlideString[] ids)
Removes the specified entries by id from a stream, and returns the number of entries deleted.- Parameters:
key- The key of the stream.ids- An array of entry ids.- Returns:
- The number of entries removed from the stream. This number may be less than the number
of entries in
ids, if the specifiedidsdon't exist in the stream. - See Also:
- valkey.io for details.
- Example:
Long num = client.xdel("key", new GlideString[] {gs("1538561698944-0"), gs("1538561698944-1")}).get(); assert num == 2L; // Stream marked 2 entries as deleted
-
xrange
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xrange(java.lang.String key, StreamRange start, StreamRange end)Returns stream entries matching a given range of IDs.- Parameters:
key- The key of the stream.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
// Retrieve all stream entries Map<String, String[][]> result = client.xrange("key", InfRangeBound.MIN, InfRangeBound.MAX).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } }); // Retrieve exactly one stream entry by id Map<String, String[][]> result = client.xrange("key", IdBound.of(streamId), IdBound.of(streamId)).get(); System.out.println("stream entry ID: " + streamid + " -> " + Arrays.toString(result.get(streamid)));
-
xrange
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xrange(GlideString key, StreamRange start, StreamRange end)
Returns stream entries matching a given range of IDs.- Parameters:
key- The key of the stream.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
// Retrieve all stream entries Map<GlideString, GlideString[][]> result = client.xrange(gs("key"), InfRangeBound.MIN, InfRangeBound.MAX).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } }); // Retrieve exactly one stream entry by id Map<GlideString, GlideString[][]> result = client.xrange(gs("key"), IdBound.of(streamId), IdBound.of(streamId)).get(); System.out.println("stream entry ID: " + streamid + " -> " + Arrays.toString(result.get(streamid)));
-
xrange
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xrange(java.lang.String key, StreamRange start, StreamRange end, long count)Returns stream entries matching a given range of IDs.- Parameters:
key- The key of the stream.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Maximum count of stream entries to return.- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. Returns ornullifcountis non-positive. - See Also:
- valkey.io for details.
- Example:
// Retrieve the first 2 stream entries Map<String, String[][]> result = client.xrange("key", InfRangeBound.MIN, InfRangeBound.MAX, 2).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } });
-
xrange
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xrange(GlideString key, StreamRange start, StreamRange end, long count)
Returns stream entries matching a given range of IDs.- Parameters:
key- The key of the stream.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Maximum count of stream entries to return.- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. Returns ornullifcountis non-positive. - See Also:
- valkey.io for details.
- Example:
// Retrieve the first 2 stream entries Map<GlideString, GlideString[][]> result = client.xrange(gs("key"), InfRangeBound.MIN, InfRangeBound.MAX, 2).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } });
-
xrevrange
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xrevrange(java.lang.String key, StreamRange end, StreamRange start)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(String, StreamRange, StreamRange)but returns the entries in reverse order.- Parameters:
key- The key of the stream.end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
// Retrieve all stream entries Map<String, String[][]> result = client.xrevrange("key", InfRangeBound.MAX, InfRangeBound.MIN).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } }); // Retrieve exactly one stream entry by id Map<String, String[][]> result = client.xrevrange("key", IdBound.of(streamId), IdBound.of(streamId)).get(); System.out.println("stream entry ID: " + streamid + " -> " + Arrays.toString(result.get(streamid)));
-
xrevrange
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xrevrange(GlideString key, StreamRange end, StreamRange start)
Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(GlideString, StreamRange, StreamRange)but returns the entries in reverse order.- Parameters:
key- The key of the stream.end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. - See Also:
- valkey.io for details.
- Example:
// Retrieve all stream entries Map<GlideString, GlideString[][]> result = client.xrevrange(gs("key"), InfRangeBound.MAX, InfRangeBound.MIN).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } }); // Retrieve exactly one stream entry by id Map<GlideString, GlideString[][]> result = client.xrevrange(gs("key"), IdBound.of(streamId), IdBound.of(streamId)).get(); System.out.println("stream entry ID: " + streamid + " -> " + Arrays.toString(result.get(streamid)));
-
xrevrange
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xrevrange(java.lang.String key, StreamRange end, StreamRange start, long count)Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(String, StreamRange, StreamRange, long)but returns the entries in reverse order.- Parameters:
key- The key of the stream.end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
count- Maximum count of stream entries to return.- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. Returns ornullifcountis non-positive. - See Also:
- valkey.io for details.
- Example:
// Retrieve the first 2 stream entries Map<String, String[][]> result = client.xrange("key", InfRangeBound.MAX, InfRangeBound.MIN, 2).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } });
-
xrevrange
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xrevrange(GlideString key, StreamRange end, StreamRange start, long count)
Returns stream entries matching a given range of IDs in reverse order.
Equivalent toxrange(GlideString, StreamRange, StreamRange, long)but returns the entries in reverse order.- Parameters:
key- The key of the stream.end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Since Valkey 6.2.0, use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
count- Maximum count of stream entries to return.- Returns:
- A
Mapof key to stream entry data, where entry data is an array of pairings with format[[field, entry], [field, entry], ...]. Returns ornullifcountis non-positive. - See Also:
- valkey.io for details.
- Example:
// Retrieve the first 2 stream entries Map<GlideString, GlideString[][]> result = client.xrange(gs("key"), InfRangeBound.MAX, InfRangeBound.MIN, 2).get(); result.forEach((k, v) -> { System.out.println("stream entry ID: " + k); for (int i = 0; i < v.length; i++) { System.out.println(v[i][0] + ": " + v[i][1]); } });
-
xgroupCreate
java.util.concurrent.CompletableFuture<java.lang.String> xgroupCreate(java.lang.String key, java.lang.String groupname, java.lang.String id)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupname- The newly created consumer group name.id- Stream entry ID that specifies the last delivered entry in the stream from the new group's perspective. The special ID"$"can be used to specify the last entry in the stream.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Create the consumer group "mygroup", using zero as the starting ID: assert client.xgroupCreate("mystream", "mygroup", "0-0").get().equals("OK");
-
xgroupCreate
java.util.concurrent.CompletableFuture<java.lang.String> xgroupCreate(GlideString key, GlideString groupname, GlideString id)
Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupname- The newly created consumer group name.id- Stream entry ID that specifies the last delivered entry in the stream from the new group's perspective. The special ID"$"can be used to specify the last entry in the stream.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Create the consumer group gs("mygroup"), using zero as the starting ID: assert client.xgroupCreate(gs("mystream"), gs("mygroup"), gs("0-0")).get().equals("OK");
-
xgroupCreate
java.util.concurrent.CompletableFuture<java.lang.String> xgroupCreate(java.lang.String key, java.lang.String groupName, java.lang.String id, StreamGroupOptions options)Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupName- The newly created consumer group name.id- Stream entry ID that specifies the last delivered entry in the stream from the new group's perspective. The special ID"$"can be used to specify the last entry in the stream.options- The group optionsStreamGroupOptions.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Create the consumer group "mygroup", and the stream if it does not exist, after the last ID assert client.xgroupCreate("mystream", "mygroup", "$", new StreamGroupOptions(true)).get().equals("OK");
-
xgroupCreate
java.util.concurrent.CompletableFuture<java.lang.String> xgroupCreate(GlideString key, GlideString groupName, GlideString id, StreamGroupOptions options)
Creates a new consumer group uniquely identified bygroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupName- The newly created consumer group name.id- Stream entry ID that specifies the last delivered entry in the stream from the new group's perspective. The special ID"$"can be used to specify the last entry in the stream.options- The group optionsStreamGroupOptions.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Create the consumer group gs("mygroup"), and the stream if it does not exist, after the last ID assert client.xgroupCreate(gs("mystream"), gs("mygroup"), gs("$"), new StreamGroupOptions(true)).get().equals("OK");
-
xgroupDestroy
java.util.concurrent.CompletableFuture<java.lang.Boolean> xgroupDestroy(java.lang.String key, java.lang.String groupname)Destroys the consumer groupgroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupname- The consumer group name to delete.- Returns:
trueif the consumer group is destroyed. Otherwise,false.- See Also:
- valkey.io for details.
- Example:
// Destroys the consumer group "mygroup" assert client.xgroupDestroy("mystream", "mygroup").get().equals("OK");
-
xgroupDestroy
java.util.concurrent.CompletableFuture<java.lang.Boolean> xgroupDestroy(GlideString key, GlideString groupname)
Destroys the consumer groupgroupnamefor the stream stored atkey.- Parameters:
key- The key of the stream.groupname- The consumer group name to delete.- Returns:
trueif the consumer group is destroyed. Otherwise,false.- See Also:
- valkey.io for details.
- Example:
// Destroys the consumer group gs("mygroup") assert client.xgroupDestroy(gs("mystream"), gs("mygroup")).get().equals("OK");
-
xgroupCreateConsumer
java.util.concurrent.CompletableFuture<java.lang.Boolean> xgroupCreateConsumer(java.lang.String key, java.lang.String group, java.lang.String consumer)Creates a consumer namedconsumerin the consumer groupgroupfor the stream stored atkey.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The newly created consumer.- Returns:
trueif the consumer is created. Otherwise,false.- See Also:
- valkey.io for details.
- Example:
// Creates the consumer "myconsumer" in consumer group "mygroup" assert client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer").get();
-
xgroupCreateConsumer
java.util.concurrent.CompletableFuture<java.lang.Boolean> xgroupCreateConsumer(GlideString key, GlideString group, GlideString consumer)
Creates a consumer namedconsumerin the consumer groupgroupfor the stream stored atkey.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The newly created consumer.- Returns:
trueif the consumer is created. Otherwise,false.- See Also:
- valkey.io for details.
- Example:
// Creates the consumer gs("myconsumer") in consumer group gs("mygroup") assert client.xgroupCreateConsumer(gs("mystream"), gs("mygroup"), gs("myconsumer")).get();
-
xgroupDelConsumer
java.util.concurrent.CompletableFuture<java.lang.Long> xgroupDelConsumer(java.lang.String key, java.lang.String group, java.lang.String consumer)Deletes a consumer namedconsumerin the consumer groupgroup.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The consumer to delete.- Returns:
- The number of pending messages the
consumerhad before it was deleted. - See Also:
- valkey.io for details.
- Example:
// Deletes the consumer "myconsumer" in consumer group "mygroup" Long pendingMsgCount = client.xgroupDelConsumer("mystream", "mygroup", "myconsumer").get(); System.out.println("Consumer 'myconsumer' had " + + pendingMsgCount + " pending messages unclaimed.");
-
xgroupDelConsumer
java.util.concurrent.CompletableFuture<java.lang.Long> xgroupDelConsumer(GlideString key, GlideString group, GlideString consumer)
Deletes a consumer namedconsumerin the consumer groupgroup.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The consumer to delete.- Returns:
- The number of pending messages the
consumerhad before it was deleted. - See Also:
- valkey.io for details.
- Example:
// Deletes the consumer gs("myconsumer") in consumer group gs("mygroup") Long pendingMsgCount = client.xgroupDelConsumer(gs("mystream"), gs("mygroup"), gs("myconsumer")).get(); System.out.println("Consumer 'myconsumer' had " + + pendingMsgCount + " pending messages unclaimed.");
-
xgroupSetId
java.util.concurrent.CompletableFuture<java.lang.String> xgroupSetId(java.lang.String key, java.lang.String groupName, java.lang.String id)Sets the last delivered ID for a consumer group.- Parameters:
key- The key of the stream.groupName- The consumer group name.id- The stream entry ID that should be set as the last delivered ID for the consumer group.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Update consumer group "mygroup", to set the last delivered entry ID. assert client.xgroupSetId("mystream", "mygroup", "0").get().equals("OK");
-
xgroupSetId
java.util.concurrent.CompletableFuture<java.lang.String> xgroupSetId(GlideString key, GlideString groupName, GlideString id)
Sets the last delivered ID for a consumer group.- Parameters:
key- The key of the stream.groupName- The consumer group name.id- The stream entry ID that should be set as the last delivered ID for the consumer group.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
// Update consumer group gs("mygroup"), to set the last delivered entry ID. assert client.xgroupSetId(gs("mystream"), gs("mygroup"), gs("0")).get().equals("OK");
-
xgroupSetId
java.util.concurrent.CompletableFuture<java.lang.String> xgroupSetId(java.lang.String key, java.lang.String groupName, java.lang.String id, long entriesRead)Sets the last delivered ID for a consumer group.- Parameters:
key- The key of the stream.groupName- The consumer group name.id- The stream entry ID that should be set as the last delivered ID for the consumer group.entriesRead- A value representing the number of stream entries already read by the group.- Returns:
OK.- Since:
- Valkey 7.0 and above
- See Also:
- valkey.io for details.
- Example:
// Update consumer group "mygroup", to set the last delivered entry ID. assert client.xgroupSetId("mystream", "mygroup", "0", 1L).get().equals("OK");
-
xgroupSetId
java.util.concurrent.CompletableFuture<java.lang.String> xgroupSetId(GlideString key, GlideString groupName, GlideString id, long entriesRead)
Sets the last delivered ID for a consumer group.- Parameters:
key- The key of the stream.groupName- The consumer group name.id- The stream entry ID that should be set as the last delivered ID for the consumer group.entriesRead- A value representing the number of stream entries already read by the group.- Returns:
OK.- Since:
- Valkey 7.0 and above
- See Also:
- valkey.io for details.
- Example:
// Update consumer group gs("mygroup"), to set the last delivered entry ID. assert client.xgroupSetId(gs("mystream"), gs("mygroup"),gs("0"), 1L).get().equals("OK");
-
xreadgroup
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>> xreadgroup(java.util.Map<java.lang.String,java.lang.String> keysAndIds, java.lang.String group, java.lang.String consumer)Reads entries from the given streams owned by a consumer group.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.
Use the special ID of">"to receive only new messages.group- The consumer group name.consumer- The consumer name.- Returns:
- A
Map<String, Map<String, String[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. Returnsnullif there is no stream that can be served. - See Also:
- valkey.io for details.
- Example:
// create a new stream at "mystream", with stream entry ID "1-0" String streamId = client.xadd("mystream", Map.of("myfield", "mydata"), StreamAddOptions.builder().id("1-0").build()).get(); assert client.xgroupCreate("mystream", "mygroup", "0-0").get().equals("OK"); // create the consumer group "mygroup" Map<String, Map<String, String[][]>> streamReadResponse = client.xreadgroup(Map.of("mystream", ">"), "mygroup", "myconsumer").get(); // Returns "mystream": "1-0": {{"myfield", "mydata"}} for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xreadgroup
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>> xreadgroup(java.util.Map<GlideString,GlideString> keysAndIds, GlideString group, GlideString consumer)
Reads entries from the given streams owned by a consumer group.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.
Use the special ID ofgs(">")to receive only new messages.group- The consumer group name.consumer- The consumer name.- Returns:
- A
Map<GlideString, Map<GlideString, GlideString[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. Returnsnullif there is no stream that can be served. - See Also:
- valkey.io for details.
- Example:
// create a new stream at gs("mystream"), with stream entry ID gs("1-0") String streamId = client.xadd(gs("mystream"), Map.of(gs("myfield"), gs("mydata")), StreamAddOptionsBinary.builder().id(gs("1-0")).build()).get(); assert client.xgroupCreate(gs("mystream"), gs("mygroup"), gs("0-0")).get().equals("OK"); // create the consumer group gs("mygroup") Map<GlideString, Map<GlideString, GlideString[][]>> streamReadResponse = client.xreadgroup(Map.of(gs("mystream"), gs(">")), gs("mygroup"), gs("myconsumer")).get(); // Returns gs("mystream"): gs("1-0"): {{gs("myfield"), gs("mydata")}} for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xreadgroup
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String[][]>>> xreadgroup(java.util.Map<java.lang.String,java.lang.String> keysAndIds, java.lang.String group, java.lang.String consumer, StreamReadGroupOptions options)Reads entries from the given streams owned by a consumer group.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.
Use the special ID of">"to receive only new messages.group- The consumer group name.consumer- The consumer name.options- Options detailing how to read the streamStreamReadGroupOptions.- Returns:
- A
Map<String, Map<String, String[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. Returnsnullif there is no stream that can be served. - See Also:
- valkey.io for details.
- Example:
// create a new stream at "mystream", with stream entry ID "1-0" String streamId = client.xadd("mystream", Map.of("myfield", "mydata"), StreamAddOptions.builder().id("1-0").build()).get(); assert client.xgroupCreate("mystream", "mygroup", "0-0").get().equals("OK"); // create the consumer group "mygroup" StreamReadGroupOptions options = StreamReadGroupOptions.builder().count(1).build(); // retrieves only a single message at a time Map<String, Map<String, String[][]>> streamReadResponse = client.xreadgroup(Map.of("mystream", ">"), "mygroup", "myconsumer", options).get(); // Returns "mystream": "1-0": {{"myfield", "mydata"}} for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xreadgroup
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.util.Map<GlideString,GlideString[][]>>> xreadgroup(java.util.Map<GlideString,GlideString> keysAndIds, GlideString group, GlideString consumer, StreamReadGroupOptions options)
Reads entries from the given streams owned by a consumer group.- Parameters:
keysAndIds- AMapof keys and entry IDs to read from.
Use the special ID ofgs(">")to receive only new messages.group- The consumer group name.consumer- The consumer name.options- Options detailing how to read the streamStreamReadGroupOptions.- Returns:
- A
Map<GlideString, Map<GlideString, GlideString[][]>>with stream keys, toMapof stream entry IDs, to an array of pairings with format[[field, entry], [field, entry], ...]. Returnsnullif there is no stream that can be served. - See Also:
- valkey.io for details.
- Example:
// create a new stream at gs("mystream"), with stream entry ID gs("1-0") String streamId = client.xadd(gs("mystream"), Map.of(gs("myfield"), gs("mydata")), StreamAddOptionsBinary.builder().id(gs("1-0")).build()).get(); assert client.xgroupCreate(gs("mystream"), gs("mygroup"), gs("0-0")).get().equals("OK"); // create the consumer group gs("mygroup") StreamReadGroupOptions options = StreamReadGroupOptions.builder().count(1).build(); // retrieves only a single message at a time Map<GlideString, Map<GlideString, GlideString[][]>> streamReadResponse = client.xreadgroup(Map.of(gs("mystream"), gs(">")), gs("mygroup"), gs("myconsumer"), options).get(); // Returns gs("mystream"): gs("1-0"): {{gs("myfield"), gs("mydata")}} for (var keyEntry : streamReadResponse.entrySet()) { System.out.printf("Key: %s", keyEntry.getKey()); for (var streamEntry : keyEntry.getValue().entrySet()) { Arrays.stream(streamEntry.getValue()).forEach(entity -> System.out.printf("stream entry ID: %s; field: %s; value: %s\n", streamEntry.getKey(), entity[0], entity[1]) ); } }
-
xack
java.util.concurrent.CompletableFuture<java.lang.Long> xack(java.lang.String key, java.lang.String group, java.lang.String[] ids)Returns the number of messages that were successfully acknowledged by the consumer group member of a stream. This command should be called on a pending message so that such message does not get processed again.- Parameters:
key- The key of the stream.group- The consumer group name.ids- Stream entry ID to acknowledge and purge messages.- Returns:
- The number of messages that were successfully acknowledged.
- See Also:
- valkey.io for details.
- Example:
String entryId = client.xadd("mystream", Map.of("myfield", "mydata")).get(); // read messages from streamId var readResult = client.xreadgroup(Map.of("mystream", entryId), "mygroup", "my0consumer").get(); // acknowledge messages on stream assert 1L == client.xack("mystream", "mygroup", new String[] {entryId}).get();
-
xack
java.util.concurrent.CompletableFuture<java.lang.Long> xack(GlideString key, GlideString group, GlideString[] ids)
Returns the number of messages that were successfully acknowledged by the consumer group member of a stream. This command should be called on a pending message so that such message does not get processed again.- Parameters:
key- The key of the stream.group- The consumer group name.ids- Stream entry ID to acknowledge and purge messages.- Returns:
- The number of messages that were successfully acknowledged.
- Example:
GlideString entryId = client.xadd(gs("mystream"), Map.of(gs("myfield"), gs("mydata")).get(); // read messages from streamId var readResult = client.xreadgroup(Map.of(gs("mystream"), entryId), gs("mygroup"), gs("my0consumer")).get(); // acknowledge messages on stream assert 1L == client.xack(gs("mystream"), gs("mygroup"), new GlideString[] {entryId}).get();
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[]> xpending(java.lang.String key, java.lang.String group)Returns stream message summary information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.- Returns:
- An
arraythat includes the summary of pending messages, with the format[NumOfMessages, StartId, EndId, [Consumer, NumOfMessages]], where:NumOfMessages: The total number of pending messages for this consumer group.StartId: The smallest ID among the pending messages.EndId: The greatest ID among the pending messages.[[Consumer, NumOfMessages], ...]: A 2D-arrayof every consumer in the consumer group with at least one pending message, and the number of pending messages it has.
- See Also:
- valkey.io for details.
- Example:
// Retrieve a summary of all pending messages from key "my_stream" Object[] result = client.xpending("my_stream", "my_group").get(); System.out.println("Number of pending messages: " + result[0]); System.out.println("Start and End ID of messages: [" + result[1] + ", " + result[2] + "]"); for (Object[] consumerResult : (Object[][]) result[3]) { System.out.println("Number of Consumer messages: [" + consumerResult[0] + ", " + consumerResult[1] + "]"); }
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[]> xpending(GlideString key, GlideString group)
Returns stream message summary information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.- Returns:
- An
arraythat includes the summary of pending messages, with the format[NumOfMessages, StartId, EndId, [Consumer, NumOfMessages]], where:NumOfMessages: The total number of pending messages for this consumer group.StartId: The smallest ID among the pending messages.EndId: The greatest ID among the pending messages.[[Consumer, NumOfMessages], ...]: A 2D-arrayof every consumer in the consumer group with at least one pending message, and the number of pending messages it has.
- See Also:
- valkey.io for details.
- Example:
// Retrieve a summary of all pending messages from key "my_stream" Object[] result = client.xpending(gs("my_stream"), gs("my_group")).get(); System.out.println("Number of pending messages: " + result[0]); System.out.println("Start and End ID of messages: [" + result[1] + ", " + result[2] + "]"); for (Object[] consumerResult : (Object[][]) result[3]) { System.out.println("Number of Consumer messages: [" + consumerResult[0] + ", " + consumerResult[1] + "]"); }
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[][]> xpending(java.lang.String key, java.lang.String group, StreamRange start, StreamRange end, long count)Returns an extended form of stream message information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Limits the number of messages returned.- Returns:
- A 2D-
arrayof 4-tuples containing extended message information with the format[[ID, Consumer, TimeElapsed, NumOfDelivered], ... ], where:ID: The ID of the message.Consumer: The name of the consumer that fetched the message and has still to acknowledge it. We call it the current owner of the message.TimeElapsed: The number of milliseconds that elapsed since the last time this message was delivered to this consumer.NumOfDelivered: The number of times this message was delivered.
- See Also:
- valkey.io for details.
- Example:
// Retrieve up to 10 pending messages from key "my_stream" in extended form Object[][] result = client.xpending("my_stream", "my_group", InfRangeBound.MIN, InfRangeBound.MAX, 10L).get(); for (Object[] messageResult : result) { System.out.printf("Message %s from consumer %s was read %s times", messageResult[0], messageResult[1], messageResult[2]); }
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[][]> xpending(GlideString key, GlideString group, StreamRange start, StreamRange end, long count)
Returns an extended form of stream message information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Limits the number of messages returned.- Returns:
- A 2D-
arrayof 4-tuples containing extended message information with the format[[ID, Consumer, TimeElapsed, NumOfDelivered], ... ], where:ID: The ID of the message.Consumer: The name of the consumer that fetched the message and has still to acknowledge it. We call it the current owner of the message.TimeElapsed: The number of milliseconds that elapsed since the last time this message was delivered to this consumer.NumOfDelivered: The number of times this message was delivered.
- See Also:
- valkey.io for details.
- Example:
// Retrieve up to 10 pending messages from key "my_stream" in extended form Object[][] result = client.xpending(gs("my_stream"), gs("my_group"), InfRangeBound.MIN, InfRangeBound.MAX, 10L).get(); for (Object[] messageResult : result) { System.out.printf("Message %s from consumer %s was read %s times", messageResult[0], messageResult[1], messageResult[2]); }
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[][]> xpending(java.lang.String key, java.lang.String group, StreamRange start, StreamRange end, long count, StreamPendingOptions options)Returns an extended form of stream message information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Limits the number of messages returned.options- Stream add optionsStreamPendingOptions.- Returns:
- A 2D-
arrayof 4-tuples containing extended message information with the format[[ID, Consumer, TimeElapsed, NumOfDelivered], ... ], where:ID: The ID of the message.Consumer: The name of the consumer that fetched the message and has still to acknowledge it. We call it the current owner of the message.TimeElapsed: The number of milliseconds that elapsed since the last time this message was delivered to this consumer.NumOfDelivered: The number of times this message was delivered.
- See Also:
- valkey.io for details.
- Example:
// Retrieve up to 10 pending messages from key "my_stream" and consumer "my_consumer" in extended form Object[][] result = client.xpending( "my_stream", "my_group", InfRangeBound.MIN, InfRangeBound.MAX, 10L, StreamPendingOptions.builder().consumer("my_consumer").build() ).get(); for (Object[] messageResult : result) { System.out.printf("Message %s from consumer %s was read %s times", messageResult[0], messageResult[1], messageResult[2]); }
-
xpending
java.util.concurrent.CompletableFuture<java.lang.Object[][]> xpending(GlideString key, GlideString group, StreamRange start, StreamRange end, long count, StreamPendingOptionsBinary options)
Returns an extended form of stream message information for pending messages matching a given range of IDs.- Parameters:
key- The key of the stream.group- The consumer group name.start- Starting stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MINto start with the minimum available ID.
- Use
end- Ending stream entry ID bound for range.- Use
StreamRange.IdBound.of(java.lang.String)to specify a stream entry ID. - Use
StreamRange.IdBound.ofExclusive(long)to specify an exclusive bounded stream entry ID. - Use
StreamRange.InfRangeBound.MAXto end with the maximum available ID.
- Use
count- Limits the number of messages returned.options- Stream add optionsStreamPendingOptionsBinary.- Returns:
- A 2D-
arrayof 4-tuples containing extended message information with the format[[ID, Consumer, TimeElapsed, NumOfDelivered], ... ], where:ID: The ID of the message.Consumer: The name of the consumer that fetched the message and has still to acknowledge it. We call it the current owner of the message.TimeElapsed: The number of milliseconds that elapsed since the last time this message was delivered to this consumer.NumOfDelivered: The number of times this message was delivered.
- See Also:
- valkey.io for details.
- Example:
// Retrieve up to 10 pending messages from key "my_stream" and consumer "my_consumer" in extended form Object[][] result = client.xpending( gs("my_stream"), gs("my_group"), InfRangeBound.MIN, InfRangeBound.MAX, 10L, StreamPendingOptionsBinary.builder().consumer(gs("my_consumer")).build() ).get(); for (Object[] messageResult : result) { System.out.printf("Message %s from consumer %s was read %s times", messageResult[0], messageResult[1], messageResult[2]); }
-
xclaim
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids)Changes the ownership of a pending message.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- A array of entry ids.- Returns:
- A
Mapof message entries with the format{"entryId": [["entry", "data"], ...], ...}that are claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// read messages from streamId for consumer1 var readResult = client.xreadgroup(Map.of("mystream", ">"), "mygroup", "consumer1").get(); // "entryId" is now read, and we can assign the pending messages to consumer2 Map<String, String[][]> results = client.xclaim("mystream", "mygroup", "consumer2", 0L, new String[] {entryId}).get(); for (String key: results.keySet()) { System.out.println(key); for (String[] entry: results.get(key)) { System.out.printf("{%s=%s}%n", entry[0], entry[1]); } }
-
xclaim
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids)
Changes the ownership of a pending message.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- A array of entry ids.- Returns:
- A
Mapof message entries with the format{"entryId": [["entry", "data"], ...], ...}that are claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// read messages from streamId for consumer1 var readResult = client.xreadgroup(Map.of(gs("mystream"), gs(">")), gs("mygroup"), gs("consumer1")).get(); // "entryId" is now read, and we can assign the pending messages to consumer2 Map<GlideString, GlideString[][]> results = client.xclaim(gs("mystream"), gs("mygroup"), gs("consumer2"), 0L, new GlideString[] {entryId}).get(); for (GlideString key: results.keySet()) { System.out.println(key); for (GlideString[] entry: results.get(key)) { System.out.printf("{%s=%s}%n", entry[0], entry[1]); } }
-
xclaim
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String[][]>> xclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids, StreamClaimOptions options)Changes the ownership of a pending message.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.options- Stream claim optionsStreamClaimOptions.- Returns:
- A
Mapof message entries with the format{"entryId": [["entry", "data"], ...], ...}that are claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// assign (force) unread and unclaimed messages to consumer2 StreamClaimOptions options = StreamClaimOptions.builder().force().build(); Map<String, String[][]> results = client.xclaim("mystream", "mygroup", "consumer2", 0L, new String[] {entryId}, options).get(); for (String key: results.keySet()) { System.out.println(key); for (String[] entry: results.get(key)) { System.out.printf("{%s=%s}%n", entry[0], entry[1]); } }
-
xclaim
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,GlideString[][]>> xclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids, StreamClaimOptions options)
Changes the ownership of a pending message.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.options- Stream claim optionsStreamClaimOptions.- Returns:
- A
Mapof message entries with the format{"entryId": [["entry", "data"], ...], ...}that are claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// assign (force) unread and unclaimed messages to consumer2 StreamClaimOptions options = StreamClaimOptions.builder().force().build(); Map<GlideString, GlideString[][]> results = client.xclaim(gs("mystream"), gs("mygroup"), gs("consumer2"), 0L, new GlideString[] {entryId}, options).get(); for (GlideString key: results.keySet()) { System.out.println(key); for (GlideString[] entry: results.get(key)) { System.out.printf("{%s=%s}%n", entry[0], entry[1]); } }
-
xclaimJustId
java.util.concurrent.CompletableFuture<java.lang.String[]> xclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids)Changes the ownership of a pending message. This function returns anarraywith only the message/entry IDs, and is equivalent to usingJUSTIDin the Valkey API.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.- Returns:
- An
arrayof message ids claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// read messages from streamId for consumer1 var readResult = client.xreadgroup(Map.of("mystream", ">"), "mygroup", "consumer1").get(); // "entryId" is now read, and we can assign the pending messages to consumer2 String[] results = client.xclaimJustId("mystream", "mygroup", "consumer2", 0L, new String[] {entryId}).get(); for (String id: results) { System.out.printf("consumer2 claimed stream entry ID: %s %n", id); }
-
xclaimJustId
java.util.concurrent.CompletableFuture<GlideString[]> xclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids)
Changes the ownership of a pending message. This function returns anarraywith only the message/entry IDs, and is equivalent to usingJUSTIDin the Valkey API.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.- Returns:
- An
arrayof message ids claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// read messages from streamId for consumer1 var readResult = client.xreadgroup(Map.of(gs("mystream"), gs(">")), gs("mygroup"), gs("consumer1")).get(); // "entryId" is now read, and we can assign the pending messages to consumer2 GlideString[] results = client.xclaimJustId(gs("mystream"), gs("mygroup"), gs("consumer2"), 0L, new GlideString[] {entryId}).get(); for (GlideString id: results) { System.out.printf("consumer2 claimed stream entry ID: %s %n", id); }
-
xclaimJustId
java.util.concurrent.CompletableFuture<java.lang.String[]> xclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String[] ids, StreamClaimOptions options)Changes the ownership of a pending message. This function returns anarraywith only the message/entry IDs, and is equivalent to usingJUSTIDin the Valkey API.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.options- Stream claim optionsStreamClaimOptions.- Returns:
- An
arrayof message ids claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// assign (force) unread and unclaimed messages to consumer2 StreamClaimOptions options = StreamClaimOptions.builder().force().build(); String[] results = client.xclaimJustId("mystream", "mygroup", "consumer2", 0L, new String[] {entryId}, options).get(); for (String id: results) { System.out.printf("consumer2 claimed stream entry ID: %s %n", id); }
-
xclaimJustId
java.util.concurrent.CompletableFuture<GlideString[]> xclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString[] ids, StreamClaimOptions options)
Changes the ownership of a pending message. This function returns anarraywith only the message/entry IDs, and is equivalent to usingJUSTIDin the Valkey API.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.ids- An array of entry ids.options- Stream claim optionsStreamClaimOptions.- Returns:
- An
arrayof message ids claimed by the consumer. - See Also:
- valkey.io for details.
- Example:
// assign (force) unread and unclaimed messages to consumer2 StreamClaimOptions options = StreamClaimOptions.builder().force().build(); GlideString[] results = client.xclaimJustId(gs("mystream"), gs("mygroup"), gs("consumer2"), 0L, new GlideString[] {entryId}, options).get(); for (GlideString id: results) { System.out.printf("consumer2 claimed stream entry ID: %s %n", id); }
-
xinfoGroups
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>[]> xinfoGroups(java.lang.String key)
Returns the list of all consumer groups and their attributes for the stream stored atkey.- Parameters:
key- The key of the stream.- Returns:
- An
ArrayofMaps, where each mapping represents the attributes of a consumer group for the stream atkey. - See Also:
- valkey.io for details.
- Example:
Map<String, Object>[] groups = client.xinfoGroups("key").get(); for (int i = 0; i < groups.length; i ++) { System.out.println("Info of group: " + groups[0].get("name")); System.out.println("\tname: " + groups[0].get("name")); System.out.println("\tconsumers: " + groups[0].get("consumers")); System.out.println("\tpending: " + groups[0].get("pending")); System.out.println("\tlast-delivered-id: " + groups[0].get("last-delivered-id")); System.out.println("\tentries-read: " + groups[0].get("entries-read")); System.out.println("\tlag: " + groups[0].get("lag")); }
-
xinfoGroups
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>[]> xinfoGroups(GlideString key)
Returns the list of all consumer groups and their attributes for the stream stored atkey.- Parameters:
key- The key of the stream.- Returns:
- An
ArrayofMaps, where each mapping represents the attributes of a consumer group for the stream atkey. - See Also:
- valkey.io for details.
- Example:
Map<GlideString, Object>[] groups = client.xinfoGroups(gs("key")).get(); for (int i = 0; i < groups.length; i ++) { System.out.println("Info of group: " + groups[0].get(gs("name"))); System.out.println("\tname: " + groups[0].get(gs("name"))); System.out.println("\tconsumers: " + groups[0].get(gs("consumers"))); System.out.println("\tpending: " + groups[0].get(gs("pending"))); System.out.println("\tlast-delivered-id: " + groups[0].get(gs("last-delivered-id"))); System.out.println("\tentries-read: " + groups[0].get(gs("entries-read"))); System.out.println("\tlag: " + groups[0].get(gs("lag"))); }
-
xinfoConsumers
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>[]> xinfoConsumers(java.lang.String key, java.lang.String groupName)Returns the list of all consumers and their attributes for the given consumer group of the stream stored atkey.- Parameters:
key- The key of the stream.groupName- The consumer group name.- Returns:
- An
ArrayofMaps, where each mapping contains the attributes of a consumer for the given consumer group of the stream atkey. - See Also:
- valkey.io for details.
- Example:
Map<String, Object>[] consumers = client.xinfoConsumers("key", "groupName").get(); for (int i = 0; i < consumers.length; i ++) { System.out.println("Info of consumer: " + consumers[0].get("name")); System.out.println("\tname: " + consumers[0].get("name")); System.out.println("\tpending: " + consumers[0].get("pending")); System.out.println("\tidle: " + consumers[0].get("idle")); System.out.println("\tinactive: " + consumers[0].get("inactive")); }
-
xinfoConsumers
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>[]> xinfoConsumers(GlideString key, GlideString groupName)
Returns the list of all consumers and their attributes for the given consumer group of the stream stored atkey.- Parameters:
key- The key of the stream.groupName- The consumer group name.- Returns:
- An
ArrayofMaps, where each mapping contains the attributes of a consumer for the given consumer group of the stream atkey. - See Also:
- valkey.io for details.
- Example:
Map<GlideString, Object>[] consumers = client.xinfoConsumers(gs("key"), gs("groupName")).get(); for (int i = 0; i < consumers.length; i ++) { System.out.println("Info of consumer: " + consumers[0].get(gs("name"))); System.out.println("\tname: " + consumers[0].get(gs("name"))); System.out.println("\tpending: " + consumers[0].get(gs("pending"))); System.out.println("\tidle: " + consumers[0].get(gs("idle"))); System.out.println("\tinactive: " + consumers[0].get(gs("inactive"))); }
-
xautoclaim
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start)Transfers ownership of pending stream entries that match the specified criteria.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A mapping of the claimed entries, with the keys being the claimed entry IDs and the
values being a 2D list of the field-value pairs in the format
[[field1, value1], [field2, value2], ...]. - If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaim("my_stream", "my_group", "my_consumer", 3_600_000L, "0-0").get(); assertEquals(streamid_1, result[0]); assertDeepEquals(Map.of(streamid_0, new String[][] {{"f1", "v1"}}),result[1]); assertDeepEquals(new Object[] {},result[2]); // version 7.0.0 or above
-
xautoclaim
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start)
Transfers ownership of pending stream entries that match the specified criteria.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A mapping of the claimed entries, with the keys being the claimed entry IDs and the
values being a 2D list of the field-value pairs in the format
[[field1, value1], [field2, value2], ...]. - If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaim(gs("my_stream"), gs("my_group"), gs("my_consumer"), 3_600_000L, gs("0-0")).get(); assertEquals(streamid_1, result[0]); assertDeepEquals(Map.of(streamid_0, new GlideString[][] {{gs("f1"), gs("v1")}}),result[1]); assertDeepEquals(new Object[] {},result[2]); // version 7.0.0 or above
-
xautoclaim
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaim(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start, long count)Transfers ownership of pending stream entries that match the specified criteria.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.count- Limits the number of claimed entries to the specified value. Default value is 100.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A mapping of the claimed entries, with the keys being the claimed entry IDs and the
values being a 2D list of the field-value pairs in the format
[[field1, value1], [field2, value2], ...]. - If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaim("my_stream", "my_group", "my_consumer", 3_600_000L, "0-0", 1L).get(); assertEquals(streamid_1, result[0]); assertDeepEquals(Map.of(streamid_0, new String[][] {{"f1", "v1"}}),result[1]); assertDeepEquals(new Object[] {},result[2]); // version 7.0.0 or above
-
xautoclaim
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaim(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start, long count)
Transfers ownership of pending stream entries that match the specified criteria.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.count- Limits the number of claimed entries to the specified value. Default value is 100.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A mapping of the claimed entries, with the keys being the claimed entry IDs and the
values being a 2D list of the field-value pairs in the format
[[field1, value1], [field2, value2], ...]. - If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaim(gs("my_stream"), gs("my_group"), gs("my_consumer"), 3_600_000L, gs("0-0"), 1L).get(); assertEquals(streamid_1, result[0]); assertDeepEquals(Map.of(streamid_0, new GlideString[][] {{gs("f1"), gs("v1")}}),result[1]); assertDeepEquals(new Object[] {},result[2]); // version 7.0.0 or above
-
xautoclaimJustId
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start)Transfers ownership of pending stream entries that match the specified criteria. This command uses theJUSTIDargument to further specify that the return value should contain a list of claimed IDs without their field-value info.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A list of the IDs for the claimed entries.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaimJustId("my_stream", "my_group", "my_consumer", 3_600_000L, "0-0").get(); assertEquals(zeroStreamId, result[0]); assertDeepEquals(new String[] {streamid_0, streamid_1, streamid_3}, result[1]); assertDeepEquals(new Object[] {}, result[2]); // version 7.0.0 or above
-
xautoclaimJustId
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start)
Transfers ownership of pending stream entries that match the specified criteria. This command uses theJUSTIDargument to further specify that the return value should contain a list of claimed IDs without their field-value info.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A list of the IDs for the claimed entries.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaimJustId(gs("my_stream"), gs("my_group"), gs("my_consumer"), 3_600_000L, gs("0-0")).get(); assertEquals(zeroStreamId, result[0]); assertDeepEquals(new GlideString[] {streamid_0, streamid_1, streamid_3}, result[1]); assertDeepEquals(new Object[] {}, result[2]); // version 7.0.0 or above
-
xautoclaimJustId
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaimJustId(java.lang.String key, java.lang.String group, java.lang.String consumer, long minIdleTime, java.lang.String start, long count)Transfers ownership of pending stream entries that match the specified criteria. This command uses theJUSTIDargument to further specify that the return value should contain a list of claimed IDs without their field-value info.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.count- Limits the number of claimed entries to the specified value. Default value is 100.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A list of the IDs for the claimed entries.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaimJustId("my_stream", "my_group", "my_consumer", 3_600_000L, "0-0", 1L).get(); assertEquals(zeroStreamId, result[0]); assertDeepEquals(new String[] {streamid_0, streamid_1, streamid_3}, result[1]); assertDeepEquals(new Object[] {}, result[2]); // version 7.0.0 or above
-
xautoclaimJustId
java.util.concurrent.CompletableFuture<java.lang.Object[]> xautoclaimJustId(GlideString key, GlideString group, GlideString consumer, long minIdleTime, GlideString start, long count)
Transfers ownership of pending stream entries that match the specified criteria. This command uses theJUSTIDargument to further specify that the return value should contain a list of claimed IDs without their field-value info.- Parameters:
key- The key of the stream.group- The consumer group name.consumer- The group consumer.minIdleTime- The minimum idle time for the message to be claimed.start- Filters the claimed entries to those that have an ID equal or greater than the specified value.count- Limits the number of claimed entries to the specified value. Default value is 100.- Returns:
- An
arraycontaining the following elements:- A stream entry ID to be used as the start argument for the next call to
XAUTOCLAIM. This ID is equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was scanned. - A list of the IDs for the claimed entries.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are deleted from the Pending Entries List.
- A stream entry ID to be used as the start argument for the next call to
- See Also:
- valkey.io for details.
- Example:
Object[] result = client.xautoclaimJustId(gs("my_stream"), gs("my_group"), gs("my_consumer"), 3_600_000L, gs("0-0"), 1L).get(); assertEquals(zeroStreamId, result[0]); assertDeepEquals(new GlideString[] {streamid_0, streamid_1, streamid_3}, result[1]); assertDeepEquals(new Object[] {}, result[2]); // version 7.0.0 or above
-
xinfoStream
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> xinfoStream(java.lang.String key)
Returns information about the stream stored at keykey.
To get more detailed information usexinfoStreamFull(String)orxinfoStreamFull(String, int).- Parameters:
key- The key of the stream.- Returns:
- A
Mapof stream information for the givenkey. See the example for a sample response. - See Also:
- valkey.io for details.
- Example:
// example of using the API: Map<String, Object> response = client.xinfoStream("myStream").get(); // the response contains data in the following format: Map<String, Object> data = Map.of( "length", 4L, "radix-tree-keys", 1L, "radix-tree-nodes", 2L, "last-generated-id", "1719877599564-0", "max-deleted-entry-id", "0-0", "entries-added", 4L, "recorded-first-entry-id", "1719710679916-0", "groups", 1L, "first-entry", new Object { "1719710679916-0", new String[] { "foo", "bar", "foo", "bar2", "some_field", "some_value" }}, "last-entry", new Object { "1719877599564-0", new String[] { { "e4_f", "e4_v" } }} ); // Stream information for "my_stream". Note that "first-entry" and "last-entry" could both be `null` if stream is empty.
-
xinfoStream
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>> xinfoStream(GlideString key)
Returns information about the stream stored at keykey.
To get more detailed information usexinfoStreamFull(GlideString)orxinfoStreamFull(GlideString, int).- Parameters:
key- The key of the stream.- Returns:
- A
Mapof stream information for the givenkey. See the example for a sample response. - See Also:
- valkey.io for details.
- Example:
// example of using the API: Map<GlideString, Object> response = client.xinfoStream(gs("myStream")).get(); // the response contains data in the following format: Map<GlideString, Object> data = Map.of( gs("length"), 4L, gs("radix-tree-keys"), 1L, gs("radix-tree-nodes"), 2L, gs("last-generated-id"), gs("1719877599564-0"), gs("max-deleted-entry-id"), gs("0-0"), gs("entries-added"), 4L, gs("recorded-first-entry-id"), gs("1719710679916-0"), gs("groups"), 1L, gs("first-entry"), new Object { gs("1719710679916-0"), new GlideString[] { gs("foo"), gs("bar"), gs("foo"), gs("bar2"), gs("some_field"), gs("some_value") }}, gs("last-entry", Object { gs("1719877599564-0"), new GlideString[] { { gs("e4_f"), gs("e4_v") } }} ); // Stream information for "my_stream". Note that "first-entry" and "last-entry" could both be `null` if stream is empty.
-
xinfoStreamFull
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> xinfoStreamFull(java.lang.String key)
Returns verbose information about the stream stored at keykey.
The output is limited by first10PEL entries.- Parameters:
key- The key of the stream.- Returns:
- A
Mapof detailed stream information for the givenkey. See the example for a sample response. - Since:
- Valkey 6.0 and above.
- See Also:
- valkey.io for details.
- Example:
// example of using the API: Map<String, Object> response = client.xinfoStreamFull("myStream").get(); // the response contains data in the following format: Map<String, Object> data = Map.of( "length", 4L, "radix-tree-keys", 1L, "radix-tree-nodes", 2L, "last-generated-id", "1719877599564-0", "max-deleted-entry-id", "0-0", "entries-added", 4L, "recorded-first-entry-id", "1719710679916-0", "entries", new Object { "1719710679916-0", new String[] { "foo", "bar", "foo", "bar2", "some_field", "some_value" }, "1719710688676-0", new String[] { { "foo", "bar2" }, }, }, "groups", new Map[] { Map.of( "name", "mygroup", "last-delivered-id", "1719710688676-0", "entries-read", 2L, "lag", 0L, "pel-count", 2L, "pending", new Object[][] { { "1719710679916-0", "Alice", 1719710707260L, 1L, }, { "1719710688676-0", "Alice", 1719710718373L, 1L } }, "consumers", new Map[] { Map.of( "name", "Alice", "seen-time", 1719710718373L, "active-time", 1719710718373L, "pel-count", 2L, "pending", new Object[][] { { "1719710679916-0", 1719710707260L, 1L, }, { "1719710688676-0", 1719710718373L, 1L } } ) }) }); // Detailed stream information for "my_stream".
-
xinfoStreamFull
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>> xinfoStreamFull(GlideString key)
Returns verbose information about the stream stored at keykey.
The output is limited by first10PEL entries.- Parameters:
key- The key of the stream.- Returns:
- A
Mapof detailed stream information for the givenkey. See the example for a sample response. - Since:
- Valkey 6.0 and above.
- See Also:
- valkey.io for details.
- Example:
// example of using the API: Map<GlideString, Object> response = client.xinfoStreamFull(gs("myStream")).get(); // the response contains data in the following format: Map<GlideString, Object> data = Map.of( gs("length"), 4L, gs("radix-tree-keys"), 1L, gs("radix-tree-nodes"), 2L, gs("last-generated-id"), gs("1719877599564-0"), gs("max-deleted-entry-id"), gs("0-0"), gs("entries-added"), 4L, gs("recorded-first-entry-id"), gs("1719710679916-0"), gs("entries"), new Object { gs("1719710679916-0"), new GlideString[] { gs("foo"), gs("bar"), gs("foo"), gs("bar2"), gs("some_field"), gs("some_value") }, gs("1719710688676-0"), new GlideString[] { { gs("foo"), gs("bar2") }, }, }, gs("groups"), new Map[] { Map.of( gs("name"), gs("mygroup"), gs("last-delivered-id"), gs("1719710688676-0"), gs("entries-read"), 2L, gs("lag"), 0L, gs("pel-count"), 2L, gs("pending"), new Object[][] { { gs("1719710679916-0"), gs("Alice"), 1719710707260L, 1L, }, { gs("1719710688676-0"), gs("Alice"), 1719710718373L, 1L } }, gs("consumers"), new Map[] { Map.of( gs("name"), gs("Alice"), gs("seen-time"), 1719710718373L, gs("active-time"), 1719710718373L, gs("pel-count"), 2L, gs("pending"), new Object[][] { { gs("1719710679916-0"), 1719710707260L, 1L, }, { gs("1719710688676-0"), 1719710718373L, 1L } } ) }) }); // Detailed stream information for "my_stream".
-
xinfoStreamFull
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> xinfoStreamFull(java.lang.String key, int count)Returns verbose information about the stream stored at keykey.- Parameters:
key- The key of the stream.count- The number of stream and PEL entries that are returned. Value of0means that all entries will be returned.- Returns:
- A
Mapof detailed stream information for the givenkey. - Since:
- Valkey 6.0 and above.
- See Also:
- valkey.io for details.
- Example:
The response has the same format as// example of using the API: Map<String, Object> response = client.xinfoStreamFull("myStream", 42).get();xinfoStreamFull(String).
-
xinfoStreamFull
java.util.concurrent.CompletableFuture<java.util.Map<GlideString,java.lang.Object>> xinfoStreamFull(GlideString key, int count)
Returns verbose information about the stream stored at keykey.- Parameters:
key- The key of the stream.count- The number of stream and PEL entries that are returned. Value of0means that all entries will be returned.- Returns:
- A
Mapof detailed stream information for the givenkey. - Since:
- Valkey 6.0 and above.
- See Also:
- valkey.io for details.
- Example:
The response has the same format as// example of using the API: Map<GlideString, Object> response = client.xinfoStreamFull(gs("myStream"), 42).get();xinfoStreamFull(GlideString).
-
-