Skip to content

Commit

Permalink
Doc updates for review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Jun 26, 2024
1 parent 969fb92 commit dcecb4d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ CompletableFuture<String> xgroupCreate(
* @param consumer The consumer name.
* @return A <code>{@literal Map<String, Map<String, String[][]>>}</code> with stream
* keys, to <code>Map</code> of stream-ids, to an array of pairings with format <code>[[field, entry], [field, entry], ...]<code>.
* Returns <code>null</code> if the consumer group does not exist.
* Returns <code>null</code> if there is no stream that can be served.
* @example
* <pre>{@code
* // create a new stream at "mystream", with stream id "1-0"
Expand Down Expand Up @@ -486,11 +486,11 @@ CompletableFuture<Map<String, Map<String, String[][]>>> xreadgroup(
* Map</code> is composed of a stream's key and the id of the entry after which the stream
* will be read. Use the special id of <code>{@literal ">"}</code> to receive only new messages.
* @param group The consumer group name.
* @param consumer The newly created consumer.
* @param consumer The consumer name.
* @param options Options detailing how to read the stream {@link StreamReadGroupOptions}.
* @return A <code>{@literal Map<String, Map<String, String[][]>>}</code> with stream
* keys, to <code>Map</code> of stream-ids, to an array of pairings with format <code>[[field, entry], [field, entry], ...]<code>.
* Returns <code>null</code> if the consumer group does not exist.
* Returns <code>null</code> if the {@link StreamReadGroupOptions#block} option is given and a timeout occurs, or if there is no stream that can be served.
* @example
* <pre>{@code
* // create a new stream at "mystream", with stream id "1-0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ public T xgroupDelConsumer(@NonNull String key, @NonNull String group, @NonNull
* @return Command Response - A <code>{@literal Map<String, Map<String, String[][]>>}</code> with
* stream keys, to <code>Map</code> of stream-ids, to an array of pairings with format <code>
* [[field, entry], [field, entry], ...]<code>.
* Returns <code>null</code> if the consumer group does not exist.
* Returns <code>null</code> if there is no stream that can be served.
*/
public T xreadgroup(
@NonNull Map<String, String> keysAndIds, @NonNull String group, @NonNull String consumer) {
Expand All @@ -3123,12 +3123,12 @@ public T xreadgroup(
* will be read. Use the special id of <code>{@literal Map<String, Map<String, String[][]>>}
* </code> to receive only new messages.
* @param group The consumer group name.
* @param consumer The newly created consumer.
* @param consumer The consumer name.
* @param options Options detailing how to read the stream {@link StreamReadGroupOptions}.
* @return Command Response - A <code>{@literal Map<String, Map<String, String[][]>>}</code> with
* stream keys, to <code>Map</code> of stream-ids, to an array of pairings with format <code>
* [[field, entry], [field, entry], ...]<code>.
* Returns <code>null</code> if the consumer group does not exist.
* Returns <code>null</code> if the {@link StreamReadGroupOptions#block} option is given and a timeout occurs, or if there is no stream that can be served.
*/
public T xreadgroup(
@NonNull Map<String, String> keysAndIds,
Expand Down
13 changes: 13 additions & 0 deletions java/integTest/src/test/java/glide/SharedCommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -4039,6 +4039,19 @@ public void xreadgroup_return_failures(BaseClient client) {
.get());
assertInstanceOf(RequestException.class, executionException.getCause());

// group doesn't exists, throws a request error with "NOGROUP"
executionException =
assertThrows(
ExecutionException.class,
() -> client.xreadgroup(Map.of(key, timestamp_1_1), "not_a_group", consumerName).get());
assertInstanceOf(RequestException.class, executionException.getCause());
assertTrue(executionException.getMessage().contains("NOGROUP"));

// consumer doesn't exists, returns an empty response
var emptyResult =
client.xreadgroup(Map.of(key, timestamp_1_1), groupName, "not_a_consumer").get();
assertEquals(0, emptyResult.get(key).size());

try (var testClient =
client instanceof RedisClient
? RedisClient.CreateClient(commonClientConfig().build()).get()
Expand Down

0 comments on commit dcecb4d

Please sign in to comment.