use redis HashCommands.hgetall and report java.lang.UnsupportedOperationException: This type doesn't hold a Map type
See original GitHub issueDescribe the bug
the hash object that I store in redis is:
{"a":1,"b":2,"c":3}
my code:
private final HashCommands<String, String, Integer> commands;
private static final String REDIS_KEY = "my_key";
public Demo(RedisDataSource ds) {
commands = ds.hash(Integer.class);
}
public Map<String, Integer> getall(){
return commands.hgetall(REDIS_KEY);
}
when i use getall function, log follows:
Caused by: java.lang.UnsupportedOperationException: This type doesn't hold a Map type
at io.vertx.redis.client.Response.getKeys(Response.java:248)
at io.vertx.mutiny.redis.client.Response.getKeys(Response.java:215)
at io.quarkus.redis.runtime.datasource.Marshaller.decodeAsMap(Marshaller.java:101)
at io.quarkus.redis.runtime.datasource.AbstractHashCommands.decodeMap(AbstractHashCommands.java:177)
at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:36)
at io.smallrye.mutiny.vertx.AsyncResultUni.lambda$subscribe$1(AsyncResultUni.java:35)
at io.smallrye.mutiny.vertx.DelegatingHandler.handle(DelegatingHandler.java:25)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.Eventually$1.onSuccess(Eventually.java:44)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.SucceededFuture.addListener(SucceededFuture.java:88)
at io.vertx.core.impl.future.Eventually.onSuccess(Eventually.java:41)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.redis.client.impl.RedisStandaloneConnection.handle(RedisStandaloneConnection.java:409)
at io.vertx.redis.client.impl.RESPParser.handleResponse(RESPParser.java:296)
at io.vertx.redis.client.impl.RESPParser.handle(RESPParser.java:128)
at io.vertx.redis.client.impl.RESPParser.handle(RESPParser.java:24)
at io.vertx.core.net.impl.NetSocketImpl.lambda$new$1(NetSocketImpl.java:100)
at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:239)
at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:129)
at io.vertx.core.net.impl.NetSocketImpl$DataMessageHandler.handle(NetSocketImpl.java:414)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:55)
at io.vertx.core.impl.ContextBase.emit(ContextBase.java:239)
at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:390)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:157)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
May I ask where I used it incorrectly.
Thanks
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a
or ver
No response
Output of java -version
17
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.13.1.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
mvnw
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
vertx-redis-client/Response.java at master - GitHub
throw new UnsupportedOperationException("This type doesn't hold a Verbatim Bulk type");. } /**. * Get this response as a Number.
Read more >Spring Data Redis
The Spring Data Redis project applies core Spring concepts to the development of solutions by using a key-value style data store.
Read more >Converting a Map<String, String> to a Value type with Jedis
Jedis doesn't offer a way to map objects to hash structures. If you are using spring, then you can look at HashMappers.
Read more >What is a Redis hash? - Redisson
Redis hashes are an implementation of the hash table or hash map data structure. Hash tables map unique keys to values. For speed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
See my PR (#28854) - not very happy with how to test on multiple Redis, but happy to get almost everything working on redis 5 (except of course, unsupported commands).
I just tried with Redis 5, and yes, they change the format. The API is designed for Redis 7.