Skip to content

Commit

Permalink
Merge pull request #24 from agorapulse/bug/redist-spec-unstable
Browse files Browse the repository at this point in the history
get more details about the wrong type returned from the transaction
  • Loading branch information
musketyr authored Jul 19, 2024
2 parents 00b4b8a + 731aa8f commit 3b25dae
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public RedisQueues(ObjectMapper objectMapper, RedisClient client, RedisPoolConfi
}

@Override
@SuppressWarnings("unchecked")
public <T> void readMessages(String queueName, int maxNumberOfMessages, Duration waitTime, Argument<T> argument, Consumer<T> action) {
TransactionResult result = withTransaction(redisCommands -> {
String key = getKey(queueName);
Expand All @@ -73,7 +74,14 @@ public <T> void readMessages(String queueName, int maxNumberOfMessages, Duration
return;
}

List<String> messages = result.get(0);

Object firstResponse = result.get(0);

if (!(firstResponse instanceof List)) {
throw new IllegalStateException("There result is not a list of Strings. Got: " + firstResponse);
}

List<String> messages = (List<String>) firstResponse;

messages.forEach(body -> {
try {
Expand Down

0 comments on commit 3b25dae

Please sign in to comment.