Skip to content

Commit 3b25dae

Browse files
authored
Merge pull request #24 from agorapulse/bug/redist-spec-unstable
get more details about the wrong type returned from the transaction
2 parents 00b4b8a + 731aa8f commit 3b25dae

File tree

1 file changed

+9
-1
lines changed
  • libs/micronaut-worker-queues-redis/src/main/java/com/agorapulse/worker/queues/redis

1 file changed

+9
-1
lines changed

libs/micronaut-worker-queues-redis/src/main/java/com/agorapulse/worker/queues/redis/RedisQueues.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public RedisQueues(ObjectMapper objectMapper, RedisClient client, RedisPoolConfi
6262
}
6363

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

76-
List<String> messages = result.get(0);
77+
78+
Object firstResponse = result.get(0);
79+
80+
if (!(firstResponse instanceof List)) {
81+
throw new IllegalStateException("There result is not a list of Strings. Got: " + firstResponse);
82+
}
83+
84+
List<String> messages = (List<String>) firstResponse;
7785

7886
messages.forEach(body -> {
7987
try {

0 commit comments

Comments
 (0)