使用Redis Stream偶发空指针问题

**问题描述:**使用redission客户端封装的stream消息队列,在进行消息轮询时,偶发出现空指针问题。

java 复制代码
[2024-11-13 09:59:20]  [] [] [redis-stream-consumer-thread-1 ] [lambda$streamMessageListenerContainer$1] [ERROR] [c.r.c.r.s.config.RedisStreamConfig] Cannot invoke "java.util.List.iterator()" because "records" is null
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "records" is null
	at org.springframework.data.redis.stream.StreamPollTask.deserializeAndEmitRecords(StreamPollTask.java:151)
	at org.springframework.data.redis.stream.StreamPollTask.doLoop(StreamPollTask.java:128)
	at org.springframework.data.redis.stream.StreamPollTask.run(StreamPollTask.java:112)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:842)

解决方案: 可以看到redission官网在3.30.0版本解决了这个问题

使用redission封装的redis stream时遇到这个问题,只需要升级redission到3.30.0之后的版本即可。

相关推荐
aqi003 小时前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵5 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf6 小时前
Agent 流程编排
后端·python·agent
copyer_xyf6 小时前
Agent RAG
后端·python·agent
copyer_xyf6 小时前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf6 小时前
Agent 记忆管理
后端·python·agent
星云穿梭21 小时前
用Python写一个带图形界面的学生管理系统——完整教程
python
金銀銅鐵1 天前
用 Pygame 实现 15 puzzle
python·数学·游戏
黄忠1 天前
大模型之LangGraph技术体系
python·llm