You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, when I read a message of type ObjectRecord from Redis Stream, the following exception occurred. I don't know how to solve it.
error info
2021-11-10 14:05:11.457 INFO 8754 --- [ main] c.h.study.redis.RedisStreamApplication : Started RedisStreamApplication in 2.598 seconds (JVM running for 3.399)
2021-11-10 14:05:11.566 INFO 8754 --- [ main] c.h.s.r.stream.producer.StreamProducer : generator book info :[Book(title=Time To Murder And Create, author=Vito Denesik)]
2021-11-10 14:05:11.662 INFO 8754 --- [ main] c.h.s.r.stream.producer.StreamProducer : return record-id:[1636524311682-0]
Exception in thread "xread-nonblock-02" java.lang.IllegalArgumentException: Value must not be null!
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.data.redis.connection.stream.Record.of(Record.java:81)
at org.springframework.data.redis.connection.stream.MapRecord.toObjectRecord(MapRecord.java:147)
at org.springframework.data.redis.core.StreamObjectMapper.toObjectRecord(StreamObjectMapper.java:138)
at org.springframework.data.redis.core.StreamObjectMapper.toObjectRecords(StreamObjectMapper.java:164)
at org.springframework.data.redis.core.StreamOperations.map(StreamOperations.java:594)
at org.springframework.data.redis.core.StreamOperations.read(StreamOperations.java:413)
at com.huan.study.redis.stream.consumer.xread.XreadNonBlockConsumer02.lambda$afterPropertiesSet$1(XreadNonBlockConsumer02.java:62)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
There are two issues coming together. First, Jackson2JsonRedisSerializer serializes strings into a Base64 representation. It doesn't deserialize Base64 back into a String, therefore the type hint is lost.
Second, StreamOperations.map(…) does not propagate the type hint into the ObjectHashMapper which is unfortunate. Those both aspects together cause the issue. Please use the regular StringRedisSerializer for the time being as hash value serializer.
Uh oh!
There was an error while loading. Please reload this page.
description
Today, when I read a message of type ObjectRecord from Redis Stream, the following exception occurred. I don't know how to solve it.
error info
core code
The code is very easy, that is, the producer generates an ObjectRecord type message, and then the consumer consumes the message.
The following is a complete example to reproduce this problem
https://github.com/huan1993/spring-data-redis-stream
The text was updated successfully, but these errors were encountered: